[TYPO3-mvc] Dependency Injection fails only in models
Christian Peters
chp at digitale-avantgarde.com
Thu Mar 22 10:16:41 CET 2012
Hello y'all,
I'm working on an extbase extension. I have some experience with flow but
little with typo3 and extbase.
However, I want to inject a repository in my model and it simply does not
work: The inject*() function does not get called. The code is copied from a
controller.
The injection works in the controller, but not in the models. This is my
code:
/**
* imageRepository
*
* @var Tx_MeineExtension_Domain_Repository_ImageRepository
*/
protected $imageRepository;
/**
* injectImageRepository
*
* @param Tx_MeineExtension_Domain_Repository_ImageRepository $imageRepository
* @return void
*/
public function
injectImageRepository(Tx_MeineExtension_Domain_Repository_ImageRepository
$imageRepository) {
die('This was called.');
$this->imageRepository = $imageRepository;
}
No errors, no clues. the inject* is simply not getting called.
I receive lot's of extbase / typo3 extmanager / typo3 persistence etc.
Notices when I turn E_ALL | E_STRICT on.
Among them:
Notice: Undefined index: Tx_MyExtension_Domain_Model_UserModel in
C:\xampp\htdocs\t3\typo3\sysext\extbase\Classes\Persistence\Mapper\DataMapFactory.php
on line 96
Notice: Undefined index: tx_bphilcore_UserModel_image_mm in
C:\xampp\htdocs\t3\typo3\sysext\extbase\Classes\Persistence\Mapper\DataMapFactory.php
on line 152
UserModel is my model that get's the imageRepository injected.
I have tried very much and am down to my last now. Has anyone a clue what I
can try next?
Caches are flushed.
Thank you for your help.
Chris
More information about the TYPO3-project-typo3v4mvc
mailing list