The Symfony manual on ParamConverter provides an example:
/** * @Route("/blog/{post_id}") * @Entity("post", expr="repository.find(post_id)") */ public function showAction(Post $post) { }
Source: http://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/converters.html#fetch-via-an-expression
But using @Entity annotation gives me this error.
The annotation "@Entity" in method AppBundle\Controller\CurrencyController::currencyAction() was never imported. Did you maybe forget to add a "use" statement for this annotation?
Obviously I need to use a namespace, but which one? Please, help.
Annotation Entityexists only on master (or futur v4). Source file here
Entity
But, as you can see, this is just a shortcut to the @ParamConverter annotation with the option expr, so you should use it before the next version.
expr
.
ParameterConverter, .
ParameterConverter
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; /** * @Route("/blog/{post_id}") * @ParamConverter("post_id", class="VendorBundle:Post") */ public function showAction(Post $post) { }
VendorBundle:Post ( ) Bundle.
VendorBundle:Post
Source: https://habr.com/ru/post/1669246/More articles:Roll connection gives NA in data.table - rSum of adjacent subsequences in an array - pythonAmazon linux: no pgbouncer packages available - pgbouncerBranching to constexpr-evaluation / overloading to constexpr - c ++Vim does: helps to have special window behavior? - vimPave the way for JavaScript objects - javascriptReverse Integrated 2D Help Table - mathHow to store data from firebaselistobservable to an array? - arrays"Script в качестве файла блокировки вывода" после использования Web Font Loader - javascripthttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1669251/jsonnet-how-to-exclude-properties-from-serialization-without-access-to-class&usg=ALkJrhj4ZtSlGGFNJzkJlvb9h6hpZ7zaVgAll Articles