php - CakePHP easy way to use different values in select input -
I have found a little "problem" with CakePHP. My code is working fine, but I I am looking for a way.
I have a model called "document" and it is related to many "users".
In my Controller I can load the list of all available users I use the following code for:
$ creator = $ this- & gt; Document-> Manufacturer- & gt; Search ('list'); $ Editors = $ this- & gt; Document-> Editor- & gt; Search ('list'); $ Responsible = $ this- & gt; Document-> Responsible person- & gt; Search ('list'); <$ Code> Compact ('Creators', 'Editors', 'Responsible)'; Now I can use this code in my thoughts:
eicho $ AT-> form-> Input ($ creator_id); Echo $ this- & gt; Form- & gt; Input ($ editor_id); Echo $ this- & gt; Form- & gt; Input ($ responsibleperson_id); This is working fine, but is it really necessary to find all 3 lists? In my controller $ builder, $ editors and $ responsible are all the same elements. Altogether, a "document" is associated with 6 different "users", so it's really about to quench my code.
Any thoughts? Thank you
If they are all connected to a single table and model then:
$ users = $ this-> Document-> Manufacturer- & gt; '(List'); And use the same list where you need the same list.
Comments
Post a Comment