public function __construct(RepositoryInterface $repository, FactoryInterface $factory, ObjectManager $manager = null, $dataClass = null) { $this->repository = $repository; $this->factory = $factory; $this->manager = $manager ?: $repository->getManager(); $this->dataClass = $dataClass ?: $repository->getEntityName(); }