Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[HttpKernel] [DX] Configurable controller layout #25422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Make Action Reference be VO
* Use ~4.1 for http-kernel to fix lower-deps test passing
  • Loading branch information
scaytrase committed Dec 22, 2017
commit 85ece54ef8be849b0478522c1b701865cad52053
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,6 @@ public function build($controller)
{
$reference = $this->layout->parse($controller);

return sprintf('%s:%s:%s', $reference->bundle->getName(), $reference->controller, $reference->action);
return sprintf('%s:%s:%s', $reference->getBundle()->getName(), $reference->getController(), $reference->getAction());
}
}
2 changes: 1 addition & 1 deletion 2 src/Symfony/Bundle/FrameworkBundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"symfony/config": "~3.4|~4.0",
"symfony/event-dispatcher": "~3.4|~4.0",
"symfony/http-foundation": "~3.4|~4.0",
"symfony/http-kernel": "~3.4|~4.0",
"symfony/http-kernel": "~3.4|~4.1",
"symfony/polyfill-mbstring": "~1.0",
"symfony/filesystem": "~3.4|~4.0",
"symfony/finder": "~3.4|~4.0",
Expand Down
23 changes: 19 additions & 4 deletions 23 src/Symfony/Component/HttpKernel/Controller/ActionReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,34 @@
*
* @author Pavel Batanov <pavel@batanov.me>
*/
class ActionReference
final class ActionReference
{
/** @var BundleInterface */
public $bundle;
private $bundle;
/** @var string */
public $controller;
private $controller;
/** @var string */
public $action;
private $action;

public function __construct(BundleInterface $bundle, string $controller, string $action)
{
$this->bundle = $bundle;
$this->controller = $controller;
$this->action = $action;
}

public function getBundle(): BundleInterface
{
return $this->bundle;
}

public function getController(): string
{
return $this->controller;
}

public function getAction(): string
{
return $this->action;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ public function parse(string $controller): ActionReference
/** {@inheritdoc} */
public function build(ActionReference $reference): string
{
$try = $reference->bundle->getNamespace().'\\Controller\\'.$reference->controller.'Controller';
$try = $reference->getBundle()->getNamespace().'\\Controller\\'.$reference->getController().'Controller';

if (!class_exists($try)) {
throw ControllerLayoutException::unknownControllerClass($reference, $try);
}

return $try.'::'.$reference->action.'Action';
return $try.'::'.$reference->getAction().'Action';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ public static function unknownControllerClass(ActionReference $reference, string
throw new static(
sprintf(
'The _controller value "%s:%s:%s" maps to a "%s" class, but this class was not found. Create this class or check the spelling of the class and its namespace.',
$reference->bundle->getName(),
$reference->controller,
$reference->action,
$reference->getBundle()->getName(),
$reference->getController(),
$reference->getAction(),
$try
)
);
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.