Note that there are some explanatory texts on larger screens.

plurals
  1. POStore a lot of object properties
    primarykey
    data
    text
    <p>I'm learning OOP PHP and have a little problem concerning classes design.</p> <p>I have a User class, that will contain basics users fields (mail, personnal infos, etc...)</p> <p>And some child class for custom user types (user, admin, client...).</p> <p>These child class have a "formFields" property. It's an array that contain all the fields needed for a form.</p> <p>Example :</p> <pre><code> array('user_mail' =&gt; array('label' =&gt; 'E-mail', 'name' =&gt; 'user[user_mail]', 'required' =&gt; 1), 'js' =&gt; 'some custom script', classes =&gt; 'css classes', etc...); </code></pre> <p>There will be a lot of forms, and a lot of fields according to the child class type...</p> <p>I'm not sure about the best way to go.</p> <p>Store these fields in object is simple at the beginning, but it's begins to be hard to maintain. (And each time i do a var_dump I get a page filled with the same properties...)</p> <p>I don't think that making a database table for each form is a good idea, because of the form multiple versions.</p> <p>I could make a single database for all the fields from all the forms, but a lot of table fields will not be used... (Or serialize them ? isn't this a bit strange ?)</p> <p>I don't see a lot of solutions, maybe someone know what is the best...</p> <p>TL/DR :</p> <p>Best way to store multiple form fields ?</p> <ul> <li>Array as object property</li> <li>Multiple tables</li> <li>One big table</li> <li>XML</li> <li>Text file or something...</li> </ul> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload