[TYPO3-mvc] Various object types depending on the "type" field
Dmitry Dulepov
dmitry.dulepov at gmail.com
Tue Feb 22 14:06:29 CET 2011
Hi!
Imagine the following "typical TYPO3" issue. You have a table with a "type"
field, which means you store different data in the same table and handle it
accordingly to the "type" field value.
If you manipulate raw database data, you do not have issues (because it is
raw). But if you do it with Extbase, you need to manipulate objects. Doing
it properly would mean either putting each data type into a separate table
(difficult for 15-20 types, which are different very little), or creating
different Extbase models depending on the "type" field.
How would you solve such issue? Would you still have a single class and use
"switch ($typeField)" or would Extbase be able to give different instances
depending on the "type" field?
The question is not theoretical, it is about a practical case I will have
in the nearest future.
(Learning, therefore asking the community)
--
Dmitry Dulepov
TYPO3 core&security team member
E-mail: dmitry.dulepov at typo3.org
Web: http://dmitry-dulepov.com/
More information about the TYPO3-project-typo3v4mvc
mailing list