Ejemplo n.º 1
0
 public function install()
 {
     \DoctrineHelper::createSchema($this->entityManager, static::getEntities());
     $this->createLicenses();
     $temporaryUploadCollection = new CollectionEntity();
     $temporaryUploadCollection->setTitle($this->__('Temporary Upload Collection'))->setDescription($this->__('This collection is needed as temporary storage for uploaded files. Do not edit or delete!'));
     $this->entityManager->persist($temporaryUploadCollection);
     $exampleCollection = new CollectionEntity();
     $exampleCollection->setTitle($this->__('Example collection'))->setDescription($this->__('Edit or delete this example collection'));
     $this->entityManager->persist($exampleCollection);
     $this->entityManager->flush();
     if ($temporaryUploadCollection->getId() != CollectionEntity::TEMPORARY_UPLOAD_COLLECTION_ID) {
         \LogUtil::registerError($this->__('The id of the generated "temporary upload collection" must be 1, but has a different value. This should not have happened. Please report this error.'));
     }
     \HookUtil::registerProviderBundles($this->version->getHookProviderBundles());
     \HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles());
     $this->setVar('descriptionEscapingStrategyForCollection', 'text');
     $this->setVar('descriptionEscapingStrategyForMedia', 'text');
     $this->setVar('defaultCollectionTemplate', 'cards');
     $this->setVar('slugEditable', true);
     $this->setVar('lastNewVersionCheck', 0);
     $this->setVar('newVersionAvailable', false);
     $this->createUploadDir();
     return true;
 }
Ejemplo n.º 2
0
 /**
  * @Route("")
  * @Method("GET")
  * @Template()
  *
  * @param Request $request
  *
  * @return array
  */
 public function displayRootAction(Request $request)
 {
     $em = $this->getDoctrine()->getManager();
     $rootCollections = $em->getRepository('CmfcmfMediaModule:Collection\\CollectionEntity')->getRootNodes();
     $rootCollections = array_filter($rootCollections, function (CollectionEntity $entity) {
         return $entity->getId() != CollectionEntity::TEMPORARY_UPLOAD_COLLECTION_ID;
     });
     // Build fake root entity.
     $entity = new CollectionEntity();
     $entity->setTitle($this->__('Root collections'))->setChildren($rootCollections)->setVirtualRoot(true);
     return $this->displayAction($request, $entity);
 }