/** * {@inheritdoc} */ public function guessUpdates(EntityManager $em, $entity, $action) { $pendings = []; if ($entity instanceof ProductTemplateInterface) { $repository = $this->registry->getRepository($this->groupClass); $variantGroup = $repository->getVariantGroupByProductTemplate($entity); if (null !== $variantGroup) { $pendings[] = $variantGroup; } } return $pendings; }
/** * {@inheritdoc} */ public function get($path) { $resolvedPath = $this->resolvePath($path); try { $node = $this->session->getNode($resolvedPath); } catch (\PHPCR\PathNotFoundException $e) { throw new ResourceNotFoundException(sprintf('No PHPCR node could be found at "%s"', $resolvedPath), null, $e); } if (null === $node) { throw new \RuntimeException('Session did not return a node or throw an exception'); } $resource = new PhpcrResource($path, $node); $resource->attachTo($this); return $resource; }
/** * Get filterable localizable attributes * @param bool $onlyInGrid * * @return AbstractAttribute[] */ public function getLocalizableAttributes($onlyInGrid = true) { $attributeManager = $this->managerRegistry->getManagerForClass($this->attributeClass); $attributeRepository = $attributeManager->getRepository($this->attributeClass); $criteria = ['localizable' => true]; if ($onlyInGrid) { $criteria['useableAsGridFilter'] = true; } $attributes = $attributeRepository->findBy($criteria); return $attributes; }
/** * Get the entity manager * * @return \Doctrine\ORM\EntityManager */ private function getEntityManager() { return $this->registry->getManagerForClass('OpiferCmsBundle:Cron'); }
* @param string $alias * @return string|void * @throws BadMethodCallException */ public function getAliasNamespace($alias) { throw new \BadMethodCallException('Namespace aliases not supported.'); } public function setContainer(Application $container) { $this->container = $container; } } // Setting up the Manager registry $app['manager_registry'] = $app->share(function () use($app) { $managerRegistry = new ManagerRegistry(null, array('db'), array('orm.em'), null, null, $app['orm.proxies_namespace']); $managerRegistry->setContainer($app); return $managerRegistry; }); // Needed to use the "entity" option in Symfony forms $app['form.extensions'] = $app->share($app->extend('form.extensions', function ($extensions, $app) { $extensions[] = new \Symfony\Bridge\Doctrine\Form\DoctrineOrmExtension($app['manager_registry']); return $extensions; })); // Needed to use the "UniqueEntity" validator. $app['validator.validator_factory'] = $app->share(function ($app) { $uniqueValidator = new Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntityValidator($app['manager_registry']); $factory = new ChamiloLMS\Component\Validator\ConstraintValidatorFactory(); $factory->addInstance('doctrine.orm.validator.unique', $uniqueValidator); return $factory; });