zfcampus/zf-apigility-doctrine — pull request #106 by pietervogelaar (2014-07-16 08:03:29+00:00)
Title: Support for deeper API paths

For the API of my current project I extended the DoctrineResource.php with the changes in this pull request. We have deeper API paths, as example:

/cars/[/:carId]
/cars/:carId/parts[/:parts]

If you fetch a certain car part with /cars/1/parts/300, the current code will give the correct car part with id 300. But /cars/2/parts/300 will also give you that part 300. But part 300 does not belong to car 2.

The code in this pull request checks if the name of the route params matches entity fields and adds them as criteria.

I also added support for composite ids in this part. I used a double underscore as delimiter, and specified values must be in the same order as the properties defined in the Doctrine entity.