Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Routing] added supported for multiple route annotations for a single…
… controller
- Loading branch information
Showing
2 changed files
with
85 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Routing\Annotation; | ||
|
||
/** | ||
* Annotation class for @Routes(). | ||
* | ||
* @author Fabien Potencier <fabien@symfony.com> | ||
*/ | ||
class Routes | ||
{ | ||
protected $routes; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param array $data An array of key/value parameters. | ||
*/ | ||
public function __construct(array $data) | ||
{ | ||
if (!isset($data['value']) || !is_array($data['value'])) { | ||
throw new \LogicException('A @Routes annotation must have an array of @Route annotation as argument.'); | ||
} | ||
|
||
$this->routes = $data['value']; | ||
} | ||
|
||
public function setRoutes($routes) | ||
{ | ||
$this->routes = $routes; | ||
} | ||
|
||
public function getRoutes() | ||
{ | ||
return $this->routes; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters