Skip to content

Instantly share code, notes, and snippets.

@weaverryan
Created May 8, 2015 15:31
Show Gist options
  • Select an option

  • Save weaverryan/0c41a49aafaad47459cf to your computer and use it in GitHub Desktop.

Select an option

Save weaverryan/0c41a49aafaad47459cf to your computer and use it in GitHub Desktop.
Possible Doctrine Param Converter
<?php
class PostController
{
/**
* @Route("/posts/{slug}")
* @DoctrineParam("post", expr="repository.findOneBySlug(slug)")
*/
public function showAction(Post $post)
{
}
}
<?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)
{
}
}
@ifdattic

ifdattic commented May 9, 2015

Copy link
Copy Markdown

Looks good :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment