I just started to use symfony 1.4 and Doctrine. (Used 1.0 - 1.2 + Propel a lot before).
I thought to give Doctrine a try, because of the fast and huge Development process in the past.
Thanks to jwage ;-)
Im using Table Inheritance. This is a small portion of my schema.yml:
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
...
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
...
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
...
Sonstige:
inheritance:
extends: Karts
type: column_aggregation
keyField: type
keyValue: 9
Im now thinking of using a simple way to create a the right form.
The user should have to select fields at the top of the form (like you can see here : http://msm-esv.dyndns.org/frontend_dev.php/fahrzeuge/insert )
You should choose the "parent class" like Rennfahrzeuge or Karts and so on.
After that the user should choose the child class like Tourenwagen or Sonstige.
Then the page should reload and display the right form.
Is there any function in Doctrine to get the inheritated/child classes for displaying them in the second select field?
(e.g. Rennfahrzeuge has Tourenwagen,..,..., Sonstige and Karts has TonyKart,...,...,Sonstige)
After that i could create dynamically the assigned form class like:
$chooseMode = $request->getParameter('chooseMode').'Form';
$modeFormClass = new $chooseMode();
or i have thought about just setting the right model in the parent form class.
What are your thoughts? I would really appreciate any suggestions and help :-)
Thanks a lot,
Marco