[TYPO3-mvc] object properties as Tx_Extbase_Persistence_ObjectStorage but without tca
Simon Schaufelberger
"schaufel\" at REMOVE-ME at berger at punkt.de
Tue Jan 25 18:27:47 CET 2011
Hi extbase people,
I have a problem with my domain model at the moment.
What I have is a project model with some properties that are stored in
the db like name and so on. All these properties are defined in the TCA.
Now i want to add an additional property $subprojects like that:
/**
* subprojects
* @var
Tx_Extbase_Persistence_ObjectStorage<Tx_PtExtlistTimesheet_Domain_Model_Project>
* @lazy
*/
protected $subprojects;
i also have a constructor for that:
public function __construct() {
$this->subprojects = new Tx_Extbase_Persistence_ObjectStorage();
}
I don't call the constructor directly but instead i do the following in
my controller:
$project = $this->projectRepository->findByUid(123);
print_r($project);
and what is get is:
----snip----
[subprojects] =>
----snip----
to make this work, i HAVE TO configure subprojects in the TCA which i
DON'T want since i don't want to store the subprojects in the DB.
what i expect is:
----snip----
[subprojects:protected] => Tx_Extbase_Persistence_ObjectStorage Object
(
[storage:protected] => Array
(
)
[isModified:protected] =>
)
----snip----
this can be done with a little hack like insert this line after getting
the project from the repository:
$project->setSubprojects(new Tx_Extbase_Persistence_ObjectStorage());
but imho this is ugly.
Later i will call a function in the model to fill the subprojects from a
repository like $project->getSubprojects(); and then do some magic in
there ;)
I think this needs to be fixed in extbase so that object storage
properties can also be used without any tca configuration.
What do you think?
--
Kind regards,
Schaufi from punkt.de
More information about the TYPO3-project-typo3v4mvc
mailing list