Created
May 8, 2015 15:31
-
-
Save weaverryan/0c41a49aafaad47459cf to your computer and use it in GitHub Desktop.
Possible Doctrine Param Converter
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
<?php | |
class PostController | |
{ | |
/** | |
* @Route("/posts/{slug}") | |
* @DoctrineParam("post", expr="repository.findOneBySlug(slug)") | |
*/ | |
public function showAction(Post $post) | |
{ | |
} | |
} |
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
<?php | |
/** | |
* Maybe have a more global way of doing this to? | |
* | |
* @DoctrineParamNamed("find_by_slug", expr="repository.findOneBySlug(slug)") | |
*/ | |
class PostController | |
{ | |
/** | |
* @Route("/posts/{slug}") | |
* @DoctrineParam("post", convert_with="find_by_slug") | |
*/ | |
public function showAction(Post $post) | |
{ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looks good :)