i guess you should have a session argument here, see for example https://github.com/doctrine/DoctrinePHPCRBundle/blob/master/Command/ImportXmlCommand.php#L41