Need a little bit of help here, because I seem to be going round in circles. Before I start, I have done a fair amount of research on this issue and have tried the solutions that have been suggested in the JMSSerializerBundle docs as well as other configuration tweaks.
Basically, I'm using FOSRestBundle to serve up an API and I chose a simple use case to prove concept before I embark on the actual business logic. I'm trying to spit out JSON representing a filtered version of \FOS\UserBundle\Propel\User but the output always contains a whole bunch of extra fields that should have been omitted via XML configuration.
As far as I can tell, I've followed the instructions to the letter so I'm a bit stumped. See code below ("foo" and "bar" swapped in for actual sensitive information)
Well, I've made progress. I stuck the serializer configuration into YML (pointing at the Propel base class), stuck the file under my main bundle's config directory (created a serializer directory) and was able to return a filtered, serialized version of the User object.
However, I am getting additional fields coming through despite the configuration explicitly set to "expose: false".
On Monday, October 8, 2012 9:59:07 AM UTC+1, Nick Winfield wrote:
> Hello,
> Need a little bit of help here, because I seem to be going round in > circles. Before I start, I have done a fair amount of research on this > issue and have tried the solutions that have been suggested in the > JMSSerializerBundle docs as well as other configuration tweaks.
> Basically, I'm using FOSRestBundle to serve up an API and I chose a simple > use case to prove concept before I embark on the actual business logic. > I'm trying to spit out JSON representing a filtered version of > \FOS\UserBundle\Propel\User but the output always contains a whole bunch of > extra fields that should have been omitted via XML configuration.
> As far as I can tell, I've followed the instructions to the letter so I'm > a bit stumped. See code below ("foo" and "bar" swapped in for actual > sensitive information)
Basically, I had to exclude all properties accessible via public methods from the BaseObject class in Propel. The reason I had to patch metadata was because the BaseObject class, where the unwanted properties reside, does not have a namespace.
On Monday, October 8, 2012 2:49:37 PM UTC+1, Nick Winfield wrote:
> Hello,
> Well, I've made progress. I stuck the serializer configuration into YML > (pointing at the Propel base class), stuck the file under my main bundle's > config directory (created a serializer directory) and was able to return a > filtered, serialized version of the User object.
> However, I am getting additional fields coming through despite the > configuration explicitly set to "expose: false".
> I only want the values from the User class, not the meta properties from > Propel's base classes. Any idea what I'm doing wrong?
> Cheers, > Nick.
> On Monday, October 8, 2012 9:59:07 AM UTC+1, Nick Winfield wrote:
>> Hello,
>> Need a little bit of help here, because I seem to be going round in >> circles. Before I start, I have done a fair amount of research on this >> issue and have tried the solutions that have been suggested in the >> JMSSerializerBundle docs as well as other configuration tweaks.
>> Basically, I'm using FOSRestBundle to serve up an API and I chose a >> simple use case to prove concept before I embark on the actual business >> logic. I'm trying to spit out JSON representing a filtered version of >> \FOS\UserBundle\Propel\User but the output always contains a whole bunch of >> extra fields that should have been omitted via XML configuration.
>> As far as I can tell, I've followed the instructions to the letter so I'm >> a bit stumped. See code below ("foo" and "bar" swapped in for actual >> sensitive information)
I'm working on learning how to use JMSSerializerBundle + FOSUserBundle
to build a REST api with Symfony 2. I'll be referencing this thread if
I run into similar problems. You can rest assure that at least one
person is reading all of this.
> Basically, I had to exclude all properties accessible via public methods
> from the BaseObject class in Propel. The reason I had to patch metadata was
> because the BaseObject class, where the unwanted properties reside, does not
> have a namespace.
> On Monday, October 8, 2012 2:49:37 PM UTC+1, Nick Winfield wrote:
>> Hello,
>> Well, I've made progress. I stuck the serializer configuration into YML
>> (pointing at the Propel base class), stuck the file under my main bundle's
>> config directory (created a serializer directory) and was able to return a
>> filtered, serialized version of the User object.
>> However, I am getting additional fields coming through despite the
>> configuration explicitly set to "expose: false".
>> I only want the values from the User class, not the meta properties from
>> Propel's base classes. Any idea what I'm doing wrong?
>> Cheers,
>> Nick.
>> On Monday, October 8, 2012 9:59:07 AM UTC+1, Nick Winfield wrote:
>>> Hello,
>>> Need a little bit of help here, because I seem to be going round in
>>> circles. Before I start, I have done a fair amount of research on this
>>> issue and have tried the solutions that have been suggested in the
>>> JMSSerializerBundle docs as well as other configuration tweaks.
>>> Basically, I'm using FOSRestBundle to serve up an API and I chose a
>>> simple use case to prove concept before I embark on the actual business
>>> logic. I'm trying to spit out JSON representing a filtered version of
>>> \FOS\UserBundle\Propel\User but the output always contains a whole bunch of
>>> extra fields that should have been omitted via XML configuration.
>>> As far as I can tell, I've followed the instructions to the letter so I'm
>>> a bit stumped. See code below ("foo" and "bar" swapped in for actual
>>> sensitive information)
>>> Has anyone had any experience using this serializer bundle with Propel
>>> objects before? If so, what did you do to get it working?
>>> Thanks in advance,
>>> Nick.
> --
> 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 "Symfony2" group.
> To post to this group, send email to symfony2@googlegroups.com
> To unsubscribe from this group, send email to
> symfony2+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/symfony2?hl=en
-- ----------------------------------------------
"May the Source be with you."
On Monday, October 8, 2012 8:50:15 AM UTC-7, Darryle wrote:
> I'm working on learning how to use JMSSerializerBundle + FOSUserBundle > to build a REST api with Symfony 2. I'll be referencing this thread if > I run into similar problems. You can rest assure that at least one > person is reading all of this.
> On Mon, Oct 8, 2012 at 11:23 AM, Nick Winfield <pio...@superhaggis.com<javascript:>> > wrote: > > Hello again,
> > Even though it feels like I'm talking to myself, I thought I'd share my > > solution. :P
> > In order to get things working, however, I had to patch in the following > PR > > for the metadata package.
> > Basically, I had to exclude all properties accessible via public methods > > from the BaseObject class in Propel. The reason I had to patch metadata > was > > because the BaseObject class, where the unwanted properties reside, does > not > > have a namespace.
> > On Monday, October 8, 2012 2:49:37 PM UTC+1, Nick Winfield wrote:
> >> Hello,
> >> Well, I've made progress. I stuck the serializer configuration into > YML > >> (pointing at the Propel base class), stuck the file under my main > bundle's > >> config directory (created a serializer directory) and was able to > return a > >> filtered, serialized version of the User object.
> >> However, I am getting additional fields coming through despite the > >> configuration explicitly set to "expose: false".
> >> I only want the values from the User class, not the meta properties > from > >> Propel's base classes. Any idea what I'm doing wrong?
> >> Cheers, > >> Nick.
> >> On Monday, October 8, 2012 9:59:07 AM UTC+1, Nick Winfield wrote:
> >>> Hello,
> >>> Need a little bit of help here, because I seem to be going round in > >>> circles. Before I start, I have done a fair amount of research on > this > >>> issue and have tried the solutions that have been suggested in the > >>> JMSSerializerBundle docs as well as other configuration tweaks.
> >>> Basically, I'm using FOSRestBundle to serve up an API and I chose a > >>> simple use case to prove concept before I embark on the actual > business > >>> logic. I'm trying to spit out JSON representing a filtered version of > >>> \FOS\UserBundle\Propel\User but the output always contains a whole > bunch of > >>> extra fields that should have been omitted via XML configuration.
> >>> As far as I can tell, I've followed the instructions to the letter so > I'm > >>> a bit stumped. See code below ("foo" and "bar" swapped in for actual > >>> sensitive information)
> >>> Has anyone had any experience using this serializer bundle with Propel > >>> objects before? If so, what did you do to get it working?
> >>> Thanks in advance, > >>> Nick.
> > -- > > 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 "Symfony2" group. > > To post to this group, send email to symf...@googlegroups.com<javascript:> > > To unsubscribe from this group, send email to > > symfony2+u...@googlegroups.com <javascript:> > > For more options, visit this group at > > http://groups.google.com/group/symfony2?hl=en
> -- > ---------------------------------------------- > "May the Source be with you."
On Monday, 8 October 2012 14:29:07 UTC+5:30, Nick Winfield wrote:
> Hello,
> Need a little bit of help here, because I seem to be going round in > circles. Before I start, I have done a fair amount of research on this > issue and have tried the solutions that have been suggested in the > JMSSerializerBundle docs as well as other configuration tweaks.
> Basically, I'm using FOSRestBundle to serve up an API and I chose a simple > use case to prove concept before I embark on the actual business logic. > I'm trying to spit out JSON representing a filtered version of > \FOS\UserBundle\Propel\User but the output always contains a whole bunch of > extra fields that should have been omitted via XML configuration.
> As far as I can tell, I've followed the instructions to the letter so I'm > a bit stumped. See code below ("foo" and "bar" swapped in for actual > sensitive information)
> Need a little bit of help here, because I seem to be going round in > circles. Before I start, I have done a fair amount of research on this > issue and have tried the solutions that have been suggested in the > JMSSerializerBundle docs as well as other configuration tweaks.
> Basically, I'm using FOSRestBundle to serve up an API and I chose a simple > use case to prove concept before I embark on the actual business logic.
> I'm trying to spit out JSON representing a filtered version of > \FOS\UserBundle\Propel\User but the output always contains a whole bunch of > extra fields that should have been omitted via XML configuration.
> As far as I can tell, I've followed the instructions to the letter so I'm > a bit stumped. See code below ("foo" and "bar" swapped in for actual > sensitive information)
> Basically, I had to exclude all properties accessible via public methods > from the BaseObject class in Propel. The reason I had to patch metadata > was because the BaseObject class, where the unwanted properties reside, > does not have a namespace.
> On Monday, October 8, 2012 2:49:37 PM UTC+1, Nick Winfield wrote:
>> Hello,
>> Well, I've made progress. I stuck the serializer configuration into YML >> (pointing at the Propel base class), stuck the file under my main bundle's >> config directory (created a serializer directory) and was able to return a >> filtered, serialized version of the User object.
>> However, I am getting additional fields coming through despite the >> configuration explicitly set to "expose: false".
>> I only want the values from the User class, not the meta properties from >> Propel's base classes. Any idea what I'm doing wrong?
>> Cheers, >> Nick.
>> On Monday, October 8, 2012 9:59:07 AM UTC+1, Nick Winfield wrote:
>>> Hello,
>>> Need a little bit of help here, because I seem to be going round in >>> circles. Before I start, I have done a fair amount of research on this >>> issue and have tried the solutions that have been suggested in the >>> JMSSerializerBundle docs as well as other configuration tweaks.
>>> Basically, I'm using FOSRestBundle to serve up an API and I chose a >>> simple use case to prove concept before I embark on the actual business >>> logic. I'm trying to spit out JSON representing a filtered version of >>> \FOS\UserBundle\Propel\User but the output always contains a whole bunch of >>> extra fields that should have been omitted via XML configuration.
>>> As far as I can tell, I've followed the instructions to the letter so >>> I'm a bit stumped. See code below ("foo" and "bar" swapped in for actual >>> sensitive information)
Any ideas? Looking at the metadata files the patch is already in, so I've just tried implementing the rest of your suggestions.
I can iterate around the PropelObjectCollection myself but I understood that the JMSSerializer should do that for me. I've been back and forth through the "official" (and very thin) documentation. If you can help with your experience that would be great?