/** * @param CategoryManager $categoryManager * @param string $categoryClass * @param string $dataClass */ public function __construct(CategoryManager $categoryManager, $categoryClass, $dataClass) { $this->categoryManager = $categoryManager; $this->categoryClass = $categoryClass; $this->dataClass = $dataClass; $this->trees = $categoryManager->getEntityRepository()->findBy(['parent' => null]); }
/** * @param CategoryManager $categoryManager * @param BulkSaverInterface $productSaver */ public function __construct(CategoryManager $categoryManager, BulkSaverInterface $productSaver) { parent::__construct($productSaver); $this->categoryManager = $categoryManager; $this->trees = $categoryManager->getEntityRepository()->findBy(array('parent' => null)); $this->categories = array(); }
/** * Find a category from its id * * @param int $categoryId * * @throws NotFoundHttpException * * @return CategoryInterface */ protected function findCategory($categoryId) { $category = $this->categoryManager->getEntityRepository()->find($categoryId); if (!$category) { throw $this->createNotFoundException('Category not found'); } return $category; }
/** * @param CategoryManager $categoryManager */ public function __construct(CategoryManager $categoryManager) { $this->categoryManager = $categoryManager; $this->trees = $categoryManager->getEntityRepository()->findBy(array('parent' => null)); $this->categories = array(); }
function let(CategoryManager $categoryManager, CategoryRepositoryInterface $categoryRepository) { $categoryRepository->findBy(['parent' => null])->willReturn(['this', 'is', 'a', 'category', 'tree']); $categoryManager->getEntityRepository()->willReturn($categoryRepository); $this->beConstructedWith($categoryManager, 'Pim\\Bundle\\CatalogBundle\\Entity\\Category', 'Pim\\Bundle\\EnrichBundle\\MassEditAction\\Operation\\Classify'); }