[TYPO3-english] Constructor injection not working after serializing+deserializing an object?

Jan Kornblum jan.kornblum at gmx.de
Sat Jul 18 01:05:09 CEST 2015

Hi newsgroup,

after serializing and deserializing an object, constructor injection 
doesn't seem to work:

class MyClass {
    public function __construct(\TYPO3\CMS\Extbase\Object\ObjectManager 
$objectManager) {
        $this->objectManager = $objectManager;
    public function __sleep() {
        $this->objectManager = null;
        return array_keys(get_object_vars($this));

$myObject = $this->objectManager->get('\MyClass');

->> $myObject->objectManager exists.

->> $myObject->objectManager is always null.

What am i missing?

Kind regards, Jan

More information about the TYPO3-english mailing list