public function findByModule(Context $context, Module $module, $culture)
 {
     $qb = $this->createQueryBuilder();
     $qb->addSelect('*');
     $qb->from($this->buildEavQuery($module), EavTables::CONTAINER_PREFIX)->where($qb->expr()->isNull(EavTables::CONTAINER_PREFIX . '.deleted'))->andWhere($qb->expr()->eq(EavTables::CONTAINER_PREFIX . '.module_id', ':module_id'))->setParameter(':module_id', $module->getId())->andWhere($qb->expr()->eq(EavTables::CONTAINER_PREFIX . '.context_id', ':context_id'))->setParameter('context_id', $context->getId())->andWhere($qb->expr()->eq(EavTables::CONTAINER_PREFIX . '.culture', ':culture'))->setParameter('culture', $culture)->orderBy(EavTables::CONTAINER_PREFIX . '.sequence', 'ASC');
     return $qb->getQuery()->getResult();
 }
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     /**
      * Create context.
      */
     $context = new Context();
     $context->setName("Default");
     $manager->persist($context);
     $manager->flush();
     $this->addReference('context', $context);
     $contextHasLanguage = new ContextHasLanguage();
     $contextHasLanguage->setContext($context);
     $contextHasLanguage->setLanguage($this->getReference("language"));
     $manager->persist($contextHasLanguage);
     $manager->flush();
 }
 /**
  * @param PersisterObjectInterface $object
  * @param ModuleInterface          $module
  *
  * @return Container|mixed
  */
 public function loadModel(ModuleInterface $module, Context $context, PersisterObjectInterface $object = null)
 {
     $container = null;
     if ($object) {
         // find container
         $container = $this->objectManager->getRepository('BigfishEavBundle:Container')->findOneBy(array('id' => $object->getId(), 'module' => $module->getId(), 'context' => $context->getId()));
     }
     // if container is not found, create one
     if (!$container) {
         $container = new Container();
         $container->setDeleted(new \DateTime());
         $container->setExpireTemporaryDate(new \DateTime('+ 3 hour'));
         $container->setModule($module);
         $container->setContext($context);
         $this->objectManager->persist($container);
         return $container;
     }
     return $container;
 }
 /**
  * @param Resource $resource
  * @param Module $module
  * @return Container
  */
 public function loadModel(ModuleInterface $module, Context $context, PersisterObjectInterface $object = null)
 {
     // find container
     $container = $this->objectManager->getRepository("BigfishEavBundle:Container")->findOneByResource($object->getId(), $module->getId(), $context->getId());
     // if container is not found, create one
     if (!$container) {
         $container = new Container();
         $container->setContext($context);
         $container->setResource($object);
         $container->setModule($module);
         $this->objectManager->persist($container);
         return $container;
     }
     return $container;
 }