Note that there are some explanatory texts on larger screens.

plurals
  1. PODoctrine inheritance. Is there an easy way to get all child classes/tables for using them in a select field in symfony forms?
    primarykey
    data
    text
    <p>I just started to use symfony 1.4 and Doctrine. (Used 1.0 - 1.2 + Propel a lot before). </p> <p>I thought to give Doctrine a try, because of the fast and huge Development process in the past. </p> <p>Thanks to jwage ;-) </p> <p>Im using Table Inheritance. This is a small portion of my schema.yml:</p> <pre><code>Articles: columns: id: type: integer(4) primary: true notnull: true autoincrement: true marken_id: type: integer(4) notnull: false user_id: type: integer(4) notnull: false address_id: type: integer(4) notnull: false </code></pre> <p>... </p> <pre><code>Vehicles: inheritance: extends: Articles type: concrete Rennfahrzeuge: columns: stvo: type: boolean notnull: false default: false inheritance: extends: Vehicles type: concrete Tourenwagen: inheritance: extends: Rennfahrzeuge type: column_aggregation keyField: type keyValue: 1 </code></pre> <p>... </p> <pre><code> Sonstige: inheritance: extends: Rennfahrzeuge type: column_aggregation keyField: type keyValue: 6 Karts: inheritance: extends: Vehicles type: concrete TonyKart: inheritance: extends: Karts type: column_aggregation keyField: type keyValue: 1 </code></pre> <p>... </p> <pre><code> Sonstige: inheritance: extends: Karts type: column_aggregation keyField: type keyValue: 9 </code></pre> <p>Im now thinking of using a simple way to create a the right form.</p> <p>The user should have to select fields at the top of the form (like you can see here : <a href="http://msm-esv.dyndns.org/frontend_dev.php/fahrzeuge/insert" rel="nofollow noreferrer">http://msm-esv.dyndns.org/frontend_dev.php/fahrzeuge/insert</a> )</p> <p>You should choose the "parent class" like Rennfahrzeuge or Karts and so on. </p> <p>After that the user should choose the child class like Tourenwagen or Sonstige. </p> <p>Then the page should reload and display the right form. </p> <p>Is there any function in Doctrine to get the inheritated/child classes for displaying them in the second select field? </p> <p>(e.g. Rennfahrzeuge has Tourenwagen,..,..., Sonstige and Karts has TonyKart,...,...,Sonstige) </p> <p>After that i could create dynamically the assigned form class like:</p> <pre><code>$chooseMode = $request-&gt;getParameter('chooseMode').'Form'; $modeFormClass = new $chooseMode(); </code></pre> <p>or i have thought about just setting the right model in the parent form class. </p> <p>What are your thoughts? I would really appreciate any suggestions and help :-) </p> <p>Thanks a lot,</p> <p>Marco </p>
    singulars
    1. This table or related slice is empty.
    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