Deserializing request Data into documents

12 views
Skip to first unread message

Maximilian Berghoff

unread,
May 19, 2016, 5:43:18 PM5/19/16
to symfony-cmf-devs
Currently i try to push the REST Support forward on two different places - content-bundle and resource-rest-bundle. And i got the solution it would be nice to base on the repositories in resource component. So we can have a a Kind of a reuseability. Some weeks ago we thought it would he better to use Kind of a ModelManager as done by sonata. But i think the repositories are fine and also work as layer that is able to handle the persistence.
Yea, but that is Not my point i just whant to inform. The point is: Even if both APIs are different, both have got the same problem to solve: Deserilization and Hydration and Validation into a document i whant to persist as a resource.

But what is the best way to do that? FOSRest's BodyListener? Sensio's Parameter converter or simple Forms? I had a quick look into SyliusResourceBundle. They choose the Form solution by the help of a FormFactory. And that is the point. WE need a generic Solution to build a form or just a factory/Repository that the User fills by the classname they will ne able to handle. So the Form is in the users hand, wand the validation too.

What do you think?

Dan

unread,
May 20, 2016, 3:25:10 AM5/20/16
to symfony-...@googlegroups.com
I am not sure ResourceRestBundle is a good candidate for a generic REST endpoint. It would be complicated at the very least.

It uses the concept of a "resource" - which is an abstract representation of the underlying entity at a given path. It does not know about the mapping of that entity, so extending it to be able to update an entity would be like writing a proxy object manager.

Operations such as renaming, moving, reordering or deleting are in-scope, but modifying the underlying entity is out-of-scope as far as I can see at the present time.

Use cases for resources are (to give two examples): Content navigation/re-organisation (e.g. tree browser) and routing.

I have been working recently on integration with the SyliusResourceBundle, which can be seen as an alternative to SonataAdminBundle, and it provides a full REST API via. FOSRestBundle which seems to work well.

There is a pending PR now on SyliusResourceBundle for a form builder for the PHPCR-ODM. So I think the SyliusResourceBundle *could* be a solution in itself.
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

GMX - Maximilian Berghoff

unread,
May 20, 2016, 3:36:18 AM5/20/16
to symfony-...@googlegroups.com

> I am not sure ResourceRestBundle is a good candidate for a generic
> REST endpoint. It would be complicated at the very least.
>
> It uses the concept of a "resource" - which is an abstract
> representation of the underlying entity at a given path. It does not
> know about the mapping of that entity, so extending it to be able to
> update an entity would be like writing a proxy object manager.
Or like the the model manager in sonata.
>
> Operations such as renaming, moving, reordering or deleting are
> in-scope, but modifying the underlying entity is out-of-scope as far
> as I can see at the present time.
>
> Use cases for resources are (to give two examples): Content
> navigation/re-organisation (e.g. tree browser) and routing.
>
I understand that, so we should restrict the edit case of
https://github.com/symfony-cmf/resource-rest-bundle/issues/6 on move
only, right?
> I have been working recently on integration with the
> SyliusResourceBundle, which can be seen as an alternative to
> SonataAdminBundle, and it provides a full REST API via. FOSRestBundle
> which seems to work well.
>
> There is a pending PR now on SyliusResourceBundle for a form builder
> for the PHPCR-ODM. So I think the SyliusResourceBundle *could* be a
> solution in itself.
Can you give me a link. I find no PR in that bundle, or is it somewhere
hidden in component?

Daniel Leech

unread,
May 20, 2016, 4:44:33 AM5/20/16
to symfony-...@googlegroups.com
On Fri, May 20, 2016 at 09:36:06AM +0200, GMX - Maximilian Berghoff wrote:
>
> > I am not sure ResourceRestBundle is a good candidate for a generic
> > REST endpoint. It would be complicated at the very least.
> >
> > It uses the concept of a "resource" - which is an abstract
> > representation of the underlying entity at a given path. It does not
> > know about the mapping of that entity, so extending it to be able to
> > update an entity would be like writing a proxy object manager.
> Or like the the model manager in sonata.
> >
> > Operations such as renaming, moving, reordering or deleting are
> > in-scope, but modifying the underlying entity is out-of-scope as far
> > as I can see at the present time.
> >
> > Use cases for resources are (to give two examples): Content
> > navigation/re-organisation (e.g. tree browser) and routing.
> >
> I understand that, so we should restrict the edit case of
> https://github.com/symfony-cmf/resource-rest-bundle/issues/6 on move
> only, right?

Move, delete and rename I think.

> > I have been working recently on integration with the
> > SyliusResourceBundle, which can be seen as an alternative to
> > SonataAdminBundle, and it provides a full REST API via. FOSRestBundle
> > which seems to work well.
> >
> > There is a pending PR now on SyliusResourceBundle for a form builder
> > for the PHPCR-ODM. So I think the SyliusResourceBundle *could* be a
> > solution in itself.
> Can you give me a link. I find no PR in that bundle, or is it somewhere
> hidden in component?

Sylius is a monolithic repository:

https://github.com/Sylius/Sylius/pull/5039

>
> --
> You received this message because you are subscribed to the Google Groups "symfony-cmf-devs" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to symfony-cmf-de...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

GMX - Maximilian Berghoff

unread,
May 20, 2016, 5:04:14 AM5/20/16
to symfony-...@googlegroups.com

> On Fri, May 20, 2016 at 09:36:06AM +0200, GMX - Maximilian Berghoff wrote:
>>> I am not sure ResourceRestBundle is a good candidate for a generic
>>> REST endpoint. It would be complicated at the very least.
>>>
>>> It uses the concept of a "resource" - which is an abstract
>>> representation of the underlying entity at a given path. It does not
>>> know about the mapping of that entity, so extending it to be able to
>>> update an entity would be like writing a proxy object manager.
>> Or like the the model manager in sonata.
>>> Operations such as renaming, moving, reordering or deleting are
>>> in-scope, but modifying the underlying entity is out-of-scope as far
>>> as I can see at the present time.
>>>
>>> Use cases for resources are (to give two examples): Content
>>> navigation/re-organisation (e.g. tree browser) and routing.
>>>
>> I understand that, so we should restrict the edit case of
>> https://github.com/symfony-cmf/resource-rest-bundle/issues/6 on move
>> only, right?
> Move, delete and rename I think.
Isn't a rename a kind of a move?
>
>>> I have been working recently on integration with the
>>> SyliusResourceBundle, which can be seen as an alternative to
>>> SonataAdminBundle, and it provides a full REST API via. FOSRestBundle
>>> which seems to work well.
>>>
>>> There is a pending PR now on SyliusResourceBundle for a form builder
>>> for the PHPCR-ODM. So I think the SyliusResourceBundle *could* be a
>>> solution in itself.
>> Can you give me a link. I find no PR in that bundle, or is it somewhere
>> hidden in component?
> Sylius is a monolithic repository:
>
> https://github.com/Sylius/Sylius/pull/5039

Thanks i will look at it, thanks.

Daniel Leech

unread,
May 20, 2016, 5:17:50 AM5/20/16
to symfony-...@googlegroups.com
On Fri, May 20, 2016 at 11:04:02AM +0200, GMX - Maximilian Berghoff wrote:
>
> > On Fri, May 20, 2016 at 09:36:06AM +0200, GMX - Maximilian Berghoff wrote:
> >>> I am not sure ResourceRestBundle is a good candidate for a generic
> >>> REST endpoint. It would be complicated at the very least.
> >>>
> >>> It uses the concept of a "resource" - which is an abstract
> >>> representation of the underlying entity at a given path. It does not
> >>> know about the mapping of that entity, so extending it to be able to
> >>> update an entity would be like writing a proxy object manager.
> >> Or like the the model manager in sonata.
> >>> Operations such as renaming, moving, reordering or deleting are
> >>> in-scope, but modifying the underlying entity is out-of-scope as far
> >>> as I can see at the present time.
> >>>
> >>> Use cases for resources are (to give two examples): Content
> >>> navigation/re-organisation (e.g. tree browser) and routing.
> >>>
> >> I understand that, so we should restrict the edit case of
> >> https://github.com/symfony-cmf/resource-rest-bundle/issues/6 on move
> >> only, right?
> > Move, delete and rename I think.
> Isn't a rename a kind of a move?


Potentially yes.

GMX - Maximilian Berghoff

unread,
May 20, 2016, 9:38:54 AM5/20/16
to symfony-...@googlegroups.com
back to my main point. For resource-rest-bundle i won't need any
de-serialization anymore i would just grab path and name from the
request parameters and do move/rename or remove it by its path. So PATCH
would be enough and right for a change request.
For content-bundle i will have a deeper look into SyliusResourcesBundle
and wait for the PR (or look if i can help)

sounds like a plan?

greets max.

Maximilian Berghoff

unread,
May 22, 2016, 5:27:59 PM5/22/16
to symfony-cmf-devs
I have head a look into SyliusResourcBundle. Looks nice, With the pending PR of dan it will be very usefull. But should we add/create a specific Enhancer to add the values sylius expects for the routing? They pass a lot of configuration throug the routing.

Daniel Leech

unread,
May 23, 2016, 4:01:43 AM5/23/16
to symfony-...@googlegroups.com
On Sun, May 22, 2016 at 02:27:59PM -0700, Maximilian Berghoff wrote:
> I have head a look into SyliusResourcBundle. Looks nice, With the pending
> PR of dan it will be very usefull. But should we add/create a specific
> Enhancer to add the values sylius expects for the routing? They pass a lot
> of configuration throug the routing.

Yes we need this functionality, see:

https://github.com/symfony-cmf/resource/issues/18

As described in the issue, the problem with the enhancers in the
resource-rest-bundle is that they only provide the URLs for the REST
interface - the problem is this information is also required in other
contexts (f.e. when building a non-REST admin interface). So I think we
need to move this a lower level (potentially as a part of the resource
component/bundle).

I am currently working on an experimental "sylius-sandbox-edition" of
the CMF, and being able to link from the tree (or in this case column) browser
to the Sylius edition pages are my next task; so I will be giving this
some attention today.

Maximilian Berghoff

unread,
May 27, 2016, 4:26:56 PM5/27/16
to symfony-cmf-devs
Dan you know why it is pending?

Daniel Leech

unread,
May 27, 2016, 4:30:47 PM5/27/16
to symfony-...@googlegroups.com
On Fri, May 27, 2016 at 01:26:55PM -0700, Maximilian Berghoff wrote:
> Am Freitag, 20. Mai 2016 10:44:33 UTC+2 schrieb dantleech:
>
> On Fri, May 20, 2016 at 09:36:06AM +0200, GMX - Maximilian Berghoff
> wrote:
> >
> > > I am not sure ResourceRestBundle is a good candidate for a generic
> > > REST endpoint. It would be complicated at the very least.
> > >
> > > It uses the concept of a "resource" - which is an abstract
> > > representation of the underlying entity at a given path. It does not
> > > know about the mapping of that entity, so extending it to be able to
> > > update an entity would be like writing a proxy object manager.
> > Or like the the model manager in sonata.
> > >
> > > Operations such as renaming, moving, reordering or deleting are
> > > in-scope, but modifying the underlying entity is out-of-scope as far
> > > as I can see at the present time.
> > >
> > > Use cases for resources are (to give two examples): Content
> > > navigation/re-organisation (e.g. tree browser) and routing.
> > >
> > I understand that, so we should restrict the edit case of
> > [1]https://github.com/symfony-cmf/resource-rest-bundle/issues/6 on
> move
> > only, right?
>
> Move, delete and rename I think.
>
> > > I have been working recently on integration with the
> > > SyliusResourceBundle, which can be seen as an alternative to
> > > SonataAdminBundle, and it provides a full REST API via.
> FOSRestBundle
> > > which seems to work well.
> > >
> > > There is a pending PR now on SyliusResourceBundle for a form builder
> > > for the PHPCR-ODM. So I think the SyliusResourceBundle *could* be a
> > > solution in itself.
> > Can you give me a link. I find no PR in that bundle, or is it
> somewhere
> > hidden in component?
>
> Sylius is a monolithic repository:
>
>     [2]https://github.com/Sylius/Sylius/pull/5039
>
> Dan you know why it is pending?

Probably need to ping Pawel after I fix the tests.

Maximilian Berghoff

unread,
May 27, 2016, 6:12:57 PM5/27/16
to symfony-cmf-devs
just tried to get exactly your change but that isn't that easy i think in a monolythic repo ... Added your fork as repository (sylius/sylius) and required dev-phpcrodm_form_builder as version for sylius/resource-bundle. But composer can't resolve that repo mismatch. You got any hints how to use that?

Dan

unread,
May 28, 2016, 2:27:14 AM5/28/16
to symfony-...@googlegroups.com
I generally symlink the resource-bundle. So I checkout Sylius independently then:

$ cd foo/my-project/vendor/sylius
$ rm resource-bundle -Rf
$ ln -s ~/foo/sylius/src/Sylius/Bundle/ResourceBundle resource-bundle

GMX - Maximilian Berghoff

unread,
May 28, 2016, 2:39:56 AM5/28/16
to symfony-...@googlegroups.com


Am 28.05.2016 um 08:27 schrieb Dan:
I generally symlink the resource-bundle. So I checkout Sylius independently then:

$ cd foo/my-project/vendor/sylius
$ rm resource-bundle -Rf
$ ln -s ~/foo/sylius/src/Sylius/Bundle/ResourceBundle resource-bundle
Hoped that there is an automatic process, but https://getcomposer.org/doc/05-repositories.md#path doesn't work (or the folder is created where i don't expect it to be). So i will try yours.



Sent from my Android device with K-9 Mail. Please excuse my brevity. --
Reply all
Reply to author
Forward
0 new messages