当前位置: 首页>>代码示例>>PHP>>正文


PHP collection::create方法代码示例

本文整理汇总了PHP中collection::create方法的典型用法代码示例。如果您正苦于以下问题:PHP collection::create方法的具体用法?PHP collection::create怎么用?PHP collection::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在collection的用法示例。


在下文中一共展示了collection::create方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createOneCollection

 public function createOneCollection()
 {
     $databoxes = self::$DI['app']['phraseanet.appbox']->get_databoxes();
     $collection = \collection::create(self::$DI['app'], array_shift($databoxes), self::$DI['app']['phraseanet.appbox'], 'TESTTODELETE');
     self::$createdCollections[] = $collection;
     return $collection;
 }
开发者ID:nlegoff,项目名称:Phraseanet,代码行数:7,代码来源:AdminCollectionTest.php

示例2: bootTestCase

 public function bootTestCase()
 {
     $application = self::$DI['app'];
     if (!self::$object) {
         if (0 === count($databoxes = self::$DI['app']['phraseanet.appbox']->get_databoxes())) {
             $this->fail('No databox found for collection test');
         }
         $databox = array_shift($databoxes);
         self::$object = collection::create(self::$DI['app'], $databox, self::$DI['app']['phraseanet.appbox'], 'test_collection', self::$DI['user']);
         self::$objectDisable = collection::create(self::$DI['app'], $databox, self::$DI['app']['phraseanet.appbox'], 'test_collection', self::$DI['user']);
         self::$objectDisable->disable(self::$DI['app']['phraseanet.appbox']);
     }
 }
开发者ID:nlegoff,项目名称:Phraseanet,代码行数:13,代码来源:collectionTest.php

示例3: setUp

 public function setUp()
 {
     parent::setup();
     if (!self::$object) {
         if (0 === count($databoxes = self::$DI['app']->getDataboxes())) {
             $this->fail('No databox found for collection test');
         }
         $databox = array_shift($databoxes);
         self::$object = collection::create(self::$DI['app'], $databox, self::$DI['app']['phraseanet.appbox'], 'test_collection', self::$DI['user']);
         self::$objectDisable = collection::create(self::$DI['app'], $databox, self::$DI['app']['phraseanet.appbox'], 'test_collection', self::$DI['user']);
         self::$objectDisable->disable(self::$DI['app']['phraseanet.appbox']);
     }
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:13,代码来源:collectionTest.php

示例4: createDB

 private function createDB(Connection $dbConn = null, $template)
 {
     $template = new \SplFileInfo(__DIR__ . '/../../../conf.d/data_templates/' . $template . '-simple.xml');
     $databox = \databox::create($this->app, $dbConn, $template);
     $this->app['acl']->get($this->app['authentication']->getUser())->give_access_to_sbas([$databox->get_sbas_id()])->update_rights_to_sbas($databox->get_sbas_id(), ['bas_manage' => 1, 'bas_modify_struct' => 1, 'bas_modif_th' => 1, 'bas_chupub' => 1]);
     $collection = \collection::create($this->app, $databox, $this->app['phraseanet.appbox'], 'test', $this->app['authentication']->getUser());
     $this->app['acl']->get($this->app['authentication']->getUser())->give_access_to_base([$collection->get_base_id()]);
     $this->app['acl']->get($this->app['authentication']->getUser())->update_rights_to_base($collection->get_base_id(), ['canpush' => 1, 'cancmd' => 1, 'canputinalbum' => 1, 'candwnldhd' => 1, 'candwnldpreview' => 1, 'canadmin' => 1, 'actif' => 1, 'canreport' => 1, 'canaddrecord' => 1, 'canmodifrecord' => 1, 'candeleterecord' => 1, 'chgstatus' => 1, 'imgtools' => 1, 'manage' => 1, 'modify_struct' => 1, 'nowatermark' => 1]);
     foreach (['PhraseanetIndexer', 'Subdefs', 'WriteMetadata'] as $jobName) {
         $job = $this->app['task-manager.job-factory']->create($jobName);
         $this->app['manipulator.task']->create($job->getName(), $job->getJobId(), $job->getEditor()->getDefaultSettings($this->app['conf']), $job->getEditor()->getDefaultPeriod());
     }
 }
开发者ID:romainneutron,项目名称:Phraseanet,代码行数:13,代码来源:Installer.php

示例5: doExecute

 protected function doExecute(InputInterface $input, OutputInterface $output)
 {
     $databox = $this->container->findDataboxById((int) $input->getArgument('databox_id'));
     $new_collection = \collection::create($this->container, $databox, $this->container->getApplicationBox(), $input->getArgument('collname'));
     if ($new_collection && $input->getOption('base_id_rights')) {
         $query = $this->container['phraseanet.user-query'];
         $total = $query->on_base_ids([$input->getOption('base_id_rights')])->get_total();
         $n = 0;
         while ($n < $total) {
             $results = $query->limit($n, 40)->execute()->get_results();
             foreach ($results as $user) {
                 $this->container->getAclForUser($user)->duplicate_right_from_bas($input->getOption('base_id_rights'), $new_collection->get_base_id());
             }
             $n += 40;
         }
     }
     $app = $this->container;
     $this->container['manipulator.acl']->resetAdminRights($this->container['repo.users']->findAdmins());
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:19,代码来源:CreateCollection.php

示例6: doExecute

 protected function doExecute(InputInterface $input, OutputInterface $output)
 {
     $databox = $this->container['phraseanet.appbox']->get_databox((int) $input->getArgument('databox_id'));
     $new_collection = \collection::create($this->container, $databox, $this->container['phraseanet.appbox'], $input->getArgument('collname'));
     if ($new_collection && $input->getOption('base_id_rights')) {
         $query = new \User_Query($this->container);
         $total = $query->on_base_ids([$input->getOption('base_id_rights')])->get_total();
         $n = 0;
         while ($n < $total) {
             $results = $query->limit($n, 40)->execute()->get_results();
             foreach ($results as $user) {
                 $this->container['acl']->get($user)->duplicate_right_from_bas($input->getOption('base_id_rights'), $new_collection->get_base_id());
             }
             $n += 40;
         }
     }
     $app = $this->container;
     $this->container['manipulator.acl']->resetAdminRights($this->container['manipulator.user']->getRepository()->findAdmins());
     $this->container['dispatcher']->dispatch(PhraseaEvents::COLLECTION_CREATE, new CollectionCreateEvent($new_collection));
 }
开发者ID:romainneutron,项目名称:Phraseanet,代码行数:20,代码来源:CreateCollection.php

示例7: generateCollection

 private function generateCollection(\Pimple $DI)
 {
     $coll = $collection_no_acces = $collection_no_acces_by_status = $db = null;
     foreach ($this->container['phraseanet.appbox']->get_databoxes() as $databox) {
         foreach ($databox->get_collections() as $collection) {
             if ($collection_no_acces instanceof \collection && !$collection_no_acces_by_status) {
                 $collection_no_acces_by_status = $collection;
             }
             if ($coll instanceof \collection && !$collection_no_acces) {
                 $collection_no_acces = $collection;
             }
             if (!$coll) {
                 $coll = $collection;
             }
             if ($coll instanceof \collection && $collection_no_acces instanceof \collection && $collection_no_acces_by_status instanceof \collection) {
                 break 2;
             }
         }
     }
     $DI['databox'] = $coll->get_databox();
     $DI['coll'] = $coll;
     if (!$collection_no_acces instanceof collection) {
         $collection_no_acces = \collection::create($this->container, $databox, $this->container['phraseanet.appbox'], 'BIBOO', $DI['user']);
     }
     $DI['coll_no_access'] = $collection_no_acces;
     if (!$collection_no_acces_by_status instanceof collection) {
         $collection_no_acces_by_status = \collection::create($this->container, $databox, $this->container['phraseanet.appbox'], 'BIBOONOACCESBYSTATUS', $DI['user']);
     }
     $DI['coll_no_status'] = $collection_no_acces_by_status;
 }
开发者ID:romainneutron,项目名称:Phraseanet,代码行数:30,代码来源:RegenerateSqliteDb.php

示例8: testPostEmptyBaseWithHighRecordAmount

 /**
  * @covers Alchemy\Phrasea\Controller\Admin\Database::emptyDatabase
  */
 public function testPostEmptyBaseWithHighRecordAmount()
 {
     $this->setAdmin(true);
     $base = $this->createDatabox();
     $collection = \collection::create(self::$DI['app'], $base, self::$DI['app']['phraseanet.appbox'], 'TESTTODELETE');
     self::$createdCollections[] = $collection;
     $sql = 'INSERT INTO record
           (coll_id, record_id, parent_record_id, moddate, credate
             , type, sha256, uuid, originalname, mime)
         VALUES
           (:coll_id, null, :parent_record_id, NOW(), NOW()
           , :type, :sha256, :uuid
           , :originalname, :mime)';
     $stmt = $base->get_connection()->prepare($sql);
     $i = 0;
     while ($i < 502) {
         $stmt->execute([':coll_id' => $collection->get_coll_id(), ':parent_record_id' => 0, ':type' => 'unknown', ':sha256' => null, ':uuid' => \uuid::generate_v4(), ':originalname' => null, ':mime' => null]);
         $i++;
     }
     $stmt->closeCursor();
     if ($collection->get_record_amount() < 500) {
         $this->markTestSkipped('No enough records added');
     }
     $this->XMLHTTPRequest('POST', '/admin/databox/' . $base->get_sbas_id() . '/empty/');
     $json = $this->getJson(self::$DI['client']->getResponse());
     $this->assertTrue($json->success);
     if (count(self::$DI['app']['EM']->getRepository('Phraseanet:Task')->findAll()) === 0) {
         $this->fail('Task for empty collection has not been created');
     }
     $base->unmount_databox();
     $base->delete();
 }
开发者ID:romainneutron,项目名称:Phraseanet,代码行数:35,代码来源:DataboxTest.php

示例9: generateCollection

 private function generateCollection(\Pimple $DI)
 {
     $coll = $collection_no_acces = $collection_no_acces_by_status = null;
     /** @var \databox[] $databoxes */
     $databoxes = $this->container->getDataboxes();
     foreach ($databoxes as $databox) {
         foreach ($databox->get_collections() as $collection) {
             if ($collection_no_acces instanceof \collection && !$collection_no_acces_by_status) {
                 $collection_no_acces_by_status = $collection;
             }
             if ($coll instanceof \collection && !$collection_no_acces) {
                 $collection_no_acces = $collection;
             }
             if (!$coll) {
                 $coll = $collection;
             }
             if ($coll instanceof \collection && $collection_no_acces instanceof \collection && $collection_no_acces_by_status instanceof \collection) {
                 break 2;
             }
         }
     }
     $DI['databox'] = $databox = $coll->get_databox();
     $DI['coll'] = $coll;
     if (!$collection_no_acces instanceof \collection) {
         $collection_no_acces = \collection::create($this->container, $databox, $this->container->getApplicationBox(), 'COLL_TEST_NO_ACCESS', $DI['user']);
     }
     $DI['coll_no_access'] = $collection_no_acces;
     if (!$collection_no_acces_by_status instanceof \collection) {
         $collection_no_acces_by_status = \collection::create($this->container, $databox, $this->container->getApplicationBox(), 'COLL_TEST_NO_ACCESS_BY_STATUS', $DI['user']);
     }
     $DI['coll_no_status'] = $collection_no_acces_by_status;
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:32,代码来源:RegenerateSqliteDb.php

示例10: createCollection

 /**
  * Create a new collection
  *
  * @param  Application $app        The silex application
  * @param  Request     $request    The current HTTP request
  * @param  integer     $databox_id The requested databox
  * @return Response
  */
 public function createCollection(Application $app, Request $request, $databox_id)
 {
     if (($name = trim($request->request->get('name', ''))) === '') {
         return $app->redirectPath('admin_database_display_new_collection_form', ['databox_id' => $databox_id, 'error' => 'name']);
     }
     try {
         $databox = $app['phraseanet.appbox']->get_databox($databox_id);
         $collection = \collection::create($app, $databox, $app['phraseanet.appbox'], $name, $app['authentication']->getUser());
         if ($request->request->get('ccusrothercoll') === "on" && null !== ($othcollsel = $request->request->get('othcollsel'))) {
             $query = $app['phraseanet.user-query'];
             $total = $query->on_base_ids([$othcollsel])->get_total();
             $n = 0;
             while ($n < $total) {
                 $results = $query->limit($n, 20)->execute()->get_results();
                 foreach ($results as $user) {
                     $app['acl']->get($user)->duplicate_right_from_bas($othcollsel, $collection->get_base_id());
                 }
                 $n += 20;
             }
         }
         $app['dispatcher']->dispatch(PhraseaEvents::COLLECTION_CREATE, new CollectionCreateEvent($collection));
         return $app->redirectPath('admin_display_collection', ['bas_id' => $collection->get_base_id(), 'success' => 1, 'reload-tree' => 1]);
     } catch (\Exception $e) {
         return $app->redirectPath('admin_database_submit_collection', ['databox_id' => $databox_id, 'error' => 'error']);
     }
 }
开发者ID:nlegoff,项目名称:Phraseanet,代码行数:34,代码来源:Databox.php

示例11: createCollection

 /**
  * Create a new collection
  *
  * @param  Request $request    The current HTTP request
  * @param  integer $databox_id The requested databox
  * @return Response
  */
 public function createCollection(Request $request, $databox_id)
 {
     if (($name = trim($request->request->get('name', ''))) === '') {
         return $this->app->redirectPath('admin_database_display_new_collection_form', ['databox_id' => $databox_id, 'error' => 'name']);
     }
     try {
         $databox = $this->findDataboxById($databox_id);
         $collection = \collection::create($this->app, $databox, $this->getApplicationBox(), $name, $this->getAuthenticator()->getUser());
         if ($request->request->get('ccusrothercoll') === "on" && null !== ($othcollsel = $request->request->get('othcollsel'))) {
             $query = $this->createUserQuery();
             $total = $query->on_base_ids([$othcollsel])->get_total();
             $n = 0;
             while ($n < $total) {
                 $results = $query->limit($n, 20)->execute()->get_results();
                 foreach ($results as $user) {
                     $this->getAclForUser($user)->duplicate_right_from_bas($othcollsel, $collection->get_base_id());
                 }
                 $n += 20;
             }
         }
         return $this->app->redirectPath('admin_display_collection', ['bas_id' => $collection->get_base_id(), 'success' => 1, 'reload-tree' => 1]);
     } catch (\Exception $e) {
         return $this->app->redirectPath('admin_database_submit_collection', ['databox_id' => $databox_id, 'error' => 'error']);
     }
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:32,代码来源:DataboxController.php

示例12: getCollectionsCombinaison

 public function getCollectionsCombinaison()
 {
     $othercollection = $collection = null;
     $app = $this->loadApp();
     $databoxes = $app['phraseanet.appbox']->get_databoxes();
     if (count($databoxes) === 0) {
         $this->fail('Unable to find collections');
     }
     $databox = array_pop($databoxes);
     foreach ($databoxes as $db) {
         if (!$collection) {
             foreach ($db->get_collections() as $coll) {
                 $collection = $coll;
                 break;
             }
         }
         if (!$othercollection && $collection) {
             foreach ($db->get_collections() as $coll) {
                 if ($coll->get_base_id() != $collection->get_base_id()) {
                     $othercollection = $coll;
                     break;
                 }
             }
         }
     }
     if (null === $othercollection) {
         $othercollection = \collection::create($app, $databox, $app['phraseanet.appbox'], 'other coll');
     }
     if (null === $collection) {
         $collection = \collection::create($app, $databox, $app['phraseanet.appbox'], 'other coll');
     }
     return [[[$collection], $collection, true], [$collection, $collection, true], [$collection, null, true], [$collection, $othercollection, false], [[$collection], $othercollection, false]];
 }
开发者ID:nlegoff,项目名称:Phraseanet,代码行数:33,代码来源:AbstractCheckerTest.php


注:本文中的collection::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。