[TYPO3-dev] Model Class __construct() never called

Popy popy.dev at gmail.com
Wed Apr 23 11:40:04 CEST 2014


Probably because the object is not constructed


Cordialement,
Pierre Dudoret


2014-04-21 23:15 GMT+02:00 <g4-lisz at tonarchiv.ch>:

> On 04/21/2014 09:18 PM, Steffen Müller wrote:
> > Hi.
> >
> > On 21.04.2014 00:33 g4-lisz at tonarchiv.ch wrote:
> >> There's one strange thing: One of the model class its __construct()
> >> method gets nerver called, even if some instances are successfully
> loaded.
> >> I also put a die(...) into the construct method - no effect!
> >>
> > I guess that happens when objects are reconstituted with unserialize().
> >
> > Solution: Use the method initializeObject() instead of __construct()
> >
> > unserialize() triggers the __wakeup() method of a model, which is
> > inherited from
> > \TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject::__wakeup()
> >
> > "If a method with the name initializeObject() exists, it is called after
> > all dependencies have been injected and configured; so you can use this
> > method for further initialization work." [1]
> Hi Steffen,
>
> thanks for the reply.
>
> Something is weird with this class. Injection didn't work, neither. I
> wanted to inject the ObjectManager. But the @inject notation didn't do
> anything. Then I put a makeInstance(ObjectManager) into __contruct(),
> but the objectManager property was still NULL afterwards.
>
> Any idea why all this doesn't work?
>
> Cheers,
> Till
> _______________________________________________
> TYPO3-dev mailing list
> TYPO3-dev at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-dev
>



More information about the TYPO3-dev mailing list