Hey Alan, fetch="EAGER" only makes sense if you always want to eagerly fetch this relation.
If you just need to eagerly fetch it in this instance, then it is sufficient to construct a DQL query where you join the relation "SELECT a,b FROM Model:A a LEFT JOIN a.myRelation b" (you can also add such a query to your repository). regards, Johannes On Thu, Oct 13, 2011 at 9:57 AM, Alan Lee <[email protected]> wrote: > it was solved by adding EAGER in ManyToOne Annotation, and > JMSSerializerBundle will then retrieve the real Entity of Word. > > @orm\ManyToOne(targetEntity="Myundle\Entity\Word", > inversedBy="fliptrackings", fetch="EAGER")) > > I think for relationship ManyToMany or OneToMany the option > fetch="EAGER" could be really bad and causes performance problem, as > they load all the entities in the associated collection. But > ManyToOne should be ok, right? > > > > > > > On Oct 13, 8:24 am, Johannes Schmitt <[email protected]> wrote: > > seehttps://github.com/schmittjoh/JMSSerializerBundle/issues/34 > > > > regards, > > Johannes > > > > > > > > > > > > > > > > On Thu, Oct 13, 2011 at 12:01 AM, Alan Lee <[email protected]> > wrote: > > > thanks, it really works. But I still have a problem when I try to > > > serialize a proxy class of an Entity. > > > > > e.g. > > > Class DIct { > > > protected $words; > > > } > > > > > Class TestController { > > > > > public function testAction() { > > > > > $word = $dict->getWords()->first(); // $word is here actually a > > > proxy class of Word > > > $serializer = $this->get('serializer'); > > > return new Response( $serializer->serialize($word , 'json')); > > > > > } > > > } > > > > > It's just an example, my question is how to serialize the proxy class > > > $word or could we get the original Word instance from proxy? > > > > > On Oct 12, 1:13 pm, Johannes Schmitt <[email protected]> wrote: > > > > You can try my bundle: > http://github.com/schmittjoh/JMSSerializerBundle > > > > > > regards, > > > > Johannes > > > > > > On Wed, Oct 12, 2011 at 9:14 AM, Alan Lee <[email protected]> > > > wrote: > > > > > Hello, > > > > > > > I'm trying to serialize an Doctrine Entity to json, but my problem > is > > > > > the GetSetMethodNormalizer seems not to work well with recursive > > > > > Entity. > > > > > > > so what's the standard or better solution if I wanna show an Entity > in > > > > > json format? > > > > > > > any comments or ideas are very welcome > > > > > > > -- > > > > > If you want to report a vulnerability issue on symfony, please send > it > > > to > > > > > security at symfony-project.com > > > > > > > You received this message because you are subscribed to the Google > > > > > Groups "symfony developers" group. > > > > > To post to this group, send email to [email protected] > > > > > To unsubscribe from this group, send email to > > > > > [email protected] > > > > > For more options, visit this group at > > > > >http://groups.google.com/group/symfony-devs?hl=en > > > > > -- > > > If you want to report a vulnerability issue on symfony, please send it > to > > > security at symfony-project.com > > > > > You received this message because you are subscribed to the Google > > > Groups "symfony developers" group. > > > To post to this group, send email to [email protected] > > > To unsubscribe from this group, send email to > > > [email protected] > > > For more options, visit this group at > > >http://groups.google.com/group/symfony-devs?hl=en > > -- > If you want to report a vulnerability issue on symfony, please send it to > security at symfony-project.com > > You received this message because you are subscribed to the Google > Groups "symfony developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/symfony-devs?hl=en > -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/symfony-devs?hl=en
