I am working on an extension and I want a particular API endpoint structure. I'm trying to have this structure:
Based on the documentation here, having entities created as direct children to the v3
or v4
directory and creating CRUD operations on those is pretty straight forward and you get most of the work done for you using civix:
Question: Is there a way to create nested entities and api endpoints so that I can create the api structure in the first image?
When I created the Certification
entity, the generated files shown in the second image support top level CRUD functionality (Ex: Certification -> Create), but not (Ex: Certification -> Math -> Skill -> Create). This is probably because of the generated BAO and DAO classes being like CRM_Certification_BAO_Certification
and the base
element in Certification.xml
being CRM/Certification
. I am sure there are other conflicts too that I am missing.
So far I have tried this code for my Read.php
endpoint under the Certification->Math->CompletedSkill
path:
The code does not execute / API not called
Note: As I mentioned above, I can get the API call to work if I make a file directly under Certification
and call it something like Getmathcompletedskills.php
and change the code to: