Message-ID: <1166376767.3210.1485852400587.JavaMail.confluence@ip-10-127-227-164> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_3209_1361010580.1485852400587" ------=_Part_3209_1361010580.1485852400587 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html How to convert request parameters into API objects

How to convert request parameters into API objects

W= hat it does

In lots of cases, a request will provide a contentId or a locationId. Be= fore using them, you will have to load API object within your controller.

For example:

=20
public function listBlogPostsAction( $locationId )
{
=09$location =3D $repository->getLocationService()->loadLocation( $lo=
cationId );
=20

Thanks to the param converter, you can directly have the API object at y= our disposal. All you have to do is:

Example using Locations:

=20
use eZ\Publish\API\Repository\Values\Content\Location;

public function listBlogPostsAction( Location $location )
{
=09// use my $location object
=20

How it wo= rks

If you want to understand how it works, you can check Symfony's param conver= ter documentation and the pull reques= t implementing the Repository ParamConverters.

How to migrate your current application

See example pull request on the DemoBun= dle it provides a few concrete examples.

------=_Part_3209_1361010580.1485852400587--