[FLOW3-general] Constructor injection in models?
Tommy Seus
tommy.seus at gmail.com
Sat Apr 24 02:06:32 CEST 2010
I have it read again:)
I have tested it just with creating a new entity. In my case it worked.
(2 month old FLOW3)
Alternatively there is the intializeObject() method.
/**
* @var \F3\Messageboard\Board\Domain\Repository\MessageRepository
*/
protected $messageRepository;
/**
* constructor
*
* @param \F3\Messageboard\Board\Domain\Repository\MessageRepository
$messageRepository
*/
public function
__construct(\F3\Messageboard\Board\Domain\Repository\MessageRepository
$messageRepository) {
$this->messageRepository = $messageRepository;
$this->messageRepository->findAll();
}
Am 23.04.2010 16:36, schrieb Michael Sauter:
> On 22.04.10 21:41, Tommy Seus wrote:
>> There are two other methods to inject objects.
>>
>> @inject or injectMethod
>
> I know, and I mentioned them in my post.
> Although they work well in general, they have the disadvantage that
> you can't use the dependency in the constructor.
>
> ~michael
> _______________________________________________
> FLOW3-general mailing list
> FLOW3-general at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general
More information about the FLOW3-general
mailing list