For exemple, I have 3 Table (Users, Contacts, Types) A User wants to create a Contact who has a specific Type, Type is a select field stored inside Contacts, has a relation one to Many How do I use the Input and Tree Commands for cake to retrive ?
I don’t think you’d need to use the Tree component, could probably do this with regular relations:
As I’m reading it, the structure is:
Contacts has one Type (“HasOne Associations” in the docs). Usually in the database it would be Contacts.type_id
User has many Contacts and these Contacts can be contacts of other Users (“BelongsToMany Associations”). For this one you need to set up a joinTable (ContactsUsers) - note the alphabetical ordering of table names and they’re plural. Inside you have two fields: Id: regular auto-increment index field, ContactsUsers.user_id, ContactsUsers.type_id both set to allow null values.
if you set this up following the conventions, Cake’s bake command can build a CRUD form for you, which can save a lot of typing.