Saturday, 15 March 2014

symfony cmf - Doctrine PHPCR - Query on ReferenceOne attribute -


I have a problem with the theory phpcr and query builder (it is possible to do a question on an attribute with ReferenceOne) (

For example:?

  / ** * @PHPCR \ ReferenceOne (targetDocument = ".... \ program") * * / Private $ program;  

But when I'm trying to create a question on it:

  $ qb-> Where () - & gt; Eq () - & gt; Region ('news.program') - & gt; Literal ($ program & gt; getId ()) - & gt; the ending ();  

I get the following error

  Can not use association property "program" class ... ... \ "a dynamic operand .  

Is there any way to ask any questions on this type of feature?

You need to use DocumentManager :: getReferrers ()

ContainerAware Reference (Controller Or stability):

  / ** @var \ principle \ ODM \ PHPCR \ DocumentManager $ dm * / $ Dm = $ this-> getContainer () - & gt; get ('doctrine_phpcr') -> getManager (); $ referer = $ DM- & gt; get recipient ($ your object, empty, empty, blank , 'Your bundle: Referrer class');  

Here it will be:

$ code = $ dm-> GetReferrers ($ program, Null, null, vulnerable, 'YourBundle: News');

No comments:

Post a Comment