• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP collection类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: addStampConf

    private function addStampConf(\collection $coll)
    {
        $domprefs = new DOMDocument();
        $domprefs->loadXML($coll->get_prefs());
        $prefs = '<?xml version="1.0" encoding="UTF-8"?>
<baseprefs>
    <status>0</status>

    <stamp>
        <logo position="left" width="25%"/>
        <text size="50%">Date: <var name="date"/></text>
        <text size="50%">Record_id: <var name="record_id"/></text>';
        foreach ($coll->get_databox()->get_meta_structure() as $databox_field) {
            $name = $databox_field->get_name();
            $prefs .= '<text size="50%">' . $name . ': <field name="' . $name . '"/></text>' . "\n";
        }
        $prefs .= '</stamp>
    <caninscript>1</caninscript>
    <sugestedValues>
    </sugestedValues>
</baseprefs>';
        $newdom = new DOMDocument();
        $newdom->loadXML($prefs);
        $coll->set_prefs($newdom);
    }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:25,代码来源:imageTest.php


示例2: doResetRightsOnCollection

 /**
  * Resets admin rights on a collection.
  *
  * @param \ACL        $acl
  * @param \collection $collection
  */
 private function doResetRightsOnCollection(\ACL $acl, \collection $collection)
 {
     $baseId = $collection->get_base_id();
     $acl->set_limits($baseId, false);
     $acl->remove_quotas_on_base($baseId);
     $acl->set_masks_on_base($baseId, '0', '0', '0', '0');
     $acl->update_rights_to_base($baseId, ['canputinalbum' => '1', 'candwnldhd' => '1', 'candwnldsubdef' => '1', 'nowatermark' => '1', 'candwnldpreview' => '1', 'cancmd' => '1', 'canadmin' => '1', 'canreport' => '1', 'canpush' => '1', 'creationdate' => '1', 'canaddrecord' => '1', 'canmodifrecord' => '1', 'candeleterecord' => '1', 'chgstatus' => '1', 'imgtools' => '1', 'manage' => '1', 'modify_struct' => '1', 'bas_modify_struct' => '1']);
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:14,代码来源:ACLManipulator.php


示例3: isCollectionAvailable

 /**
  * Returns true if a collection is available given a configuration.
  *
  * @param \collection $collection
  *
  * @return Boolean
  */
 public function isCollectionAvailable(\collection $collection)
 {
     if (!$this->isRestricted()) {
         return true;
     }
     $availableCollections = $this->cache->fetch('available_collections_' . $collection->get_databox()->get_sbas_id()) ?: [];
     return in_array($collection->get_base_id(), $availableCollections, true);
 }
开发者ID:nlegoff,项目名称:Phraseanet,代码行数:15,代码来源:AccessRestriction.php


示例4: set_collection_order

 /**
  *
  * @param  collection $collection
  * @param  <type>     $ordre
  * @return appbox
  */
 public function set_collection_order(collection $collection, $ordre)
 {
     $sqlupd = "UPDATE bas SET ord = :ordre WHERE base_id = :base_id";
     $stmt = $this->get_connection()->prepare($sqlupd);
     $stmt->execute([':ordre' => $ordre, ':base_id' => $collection->get_base_id()]);
     $stmt->closeCursor();
     $collection->get_databox()->delete_data_from_cache(\databox::CACHE_COLLECTIONS);
     return $this;
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:15,代码来源:appbox.php


示例5: createEmptyCollectionJob

 /**
  * Creates a EmptyCollection task given a collection
  *
  * @param \collection $collection
  *
  * @return Task
  */
 public function createEmptyCollectionJob(\collection $collection)
 {
     $job = new EmptyCollectionJob($this->translator);
     $settings = simplexml_load_string($job->getEditor()->getDefaultSettings());
     $settings->bas_id = $collection->get_base_id();
     $task = new Task();
     $task->setName($job->getName())->setJobId($job->getJobId())->setSettings($settings->asXML())->setPeriod($job->getEditor()->getDefaultPeriod());
     $this->om->persist($task);
     $this->om->flush();
     $this->notify(NotifierInterface::MESSAGE_CREATE);
     return $task;
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:19,代码来源:TaskManipulator.php


示例6: plansDatatablesAjaxHandler

 public function plansDatatablesAjaxHandler(Request $request)
 {
     if ($request->input('method') == "first") {
         $objModelPlan = Plan::getInstance();
         $whereForPlans = array('rawQuery' => 'status = 1 or status = 0');
         $planLists = $objModelPlan->getAllPlansWhere($whereForPlans);
         $planLists = json_decode(json_encode($planLists), true);
         $plans = new collection();
         foreach ($planLists as $aap) {
             $id = $aap['plan_id'];
             $statusClass = $aap['status'] == 1 ? 'fa fa-check-circle' : 'fa fa-times-circle';
             $color = $aap['status'] == 1 ? 'green' : 'red';
             $text = $aap['status'] == 1 ? 'Active' : 'Inactive';
             $bgcolor = $aap['status'] == 1 ? 'lightgreen' : 'lightpink';
             $plans->push(['service' => $aap['plan_name'], 'min' => $aap['min_quantity'], 'max' => $aap['max_quantity'], 'ratepk' => $aap['charge_per_unit'], 'status' => '<div class="switch" id="status" data-id="' . $id . '" style="background-color:' . $color . '" >
             <input id=' . $id . ' class="cmn-toggle cmn-toggle-yes-no" type="checkbox" style="background-color:' . $color . '">
             <label for=' . $id . ' data-text="' . $text . '"></label>
         </div>', 'edit' => '<a href="/admin/plans-list-edit/' . $aap['plan_id'] . '" class="btn btn-sm btn-warning">Edit</a>']);
         }
         return Datatables::of($plans)->make(true);
     } else {
         if ($request->input('method') == "second") {
             $planType = $request->input('planType');
             $serviceType = $request->input('serviceType');
             $objModelPlans = Plan::getInstance();
             if ($planType == 5 && $serviceType == 5) {
                 $where = array('rawQuery' => 'status = 1 or status = 0');
             } elseif ($planType == 5 && $serviceType != 5) {
                 $where = array('rawQuery' => 'plan_type IN (0,1,3,4)  and service_type=?', 'bindParams' => [$serviceType]);
             } elseif ($planType != 5 && $serviceType == 5) {
                 $where = array('rawQuery' => 'service_type IN ("R","F","T") and plan_type =?', 'bindParams' => [$planType]);
             } else {
                 $where = array('rawQuery' => 'plan_type=? and service_type=?', 'bindParams' => [$planType, $serviceType]);
             }
             $planLists = $objModelPlans->getAllPlansWhere($where);
             $planLists = json_decode(json_encode($planLists), true);
             $plans = new collection();
             foreach ($planLists as $aap) {
                 $id = $aap['plan_id'];
                 $statusClass = $aap['status'] == 1 ? 'fa fa-check-circle' : 'fa fa-times-circle';
                 $color = $aap['status'] == 1 ? 'green' : 'red';
                 $bgcolor = $aap['status'] == 1 ? 'lightgreen' : 'lightpink';
                 $plans->push(['service' => $aap['plan_name'], 'min' => $aap['min_quantity'], 'max' => $aap['max_quantity'], 'ratepk' => $aap['charge_per_unit'], 'status' => '<a href="javascript:;" id="status" class="btn btn-sm btn-raised ' . $statusClass . '" style="color:' . $color . '; background-color:' . $bgcolor . '" data-id=' . $id . ' ></a>', 'edit' => '<a href="/admin/plans-list-edit/' . $aap['plan_id'] . '" class="btn btn-sm btn-warning">Edit</a>']);
             }
             return Datatables::of($plans)->make(true);
         }
     }
 }
开发者ID:sumitglobussoft,项目名称:INSTAGRAM-PANEL,代码行数:48,代码来源:PlansController.php


示例7: apply

 public function apply(Application $app, Request $request)
 {
     $records = RecordsRequest::fromRequest($app, $request, false, ['candeleterecord']);
     $datas = ['success' => false, 'message' => ''];
     try {
         if (null === $request->request->get('base_id')) {
             $datas['message'] = $app->trans('Missing target collection');
             return $app->json($datas);
         }
         if (!$app['acl']->get($app['authentication']->getUser())->has_right_on_base($request->request->get('base_id'), 'canaddrecord')) {
             $datas['message'] = $app->trans("You do not have the permission to move records to %collection%", ['%collection%', \phrasea::bas_labels($request->request->get('base_id'), $app)]);
             return $app->json($datas);
         }
         try {
             $collection = \collection::get_from_base_id($app, $request->request->get('base_id'));
         } catch (\Exception_Databox_CollectionNotFound $e) {
             $datas['message'] = $app->trans('Invalid target collection');
             return $app->json($datas);
         }
         foreach ($records as $record) {
             $record->move_to_collection($collection, $app['phraseanet.appbox']);
             if ($request->request->get("chg_coll_son") == "1") {
                 foreach ($record->get_children() as $child) {
                     if ($app['acl']->get($app['authentication']->getUser())->has_right_on_base($child->get_base_id(), 'candeleterecord')) {
                         $child->move_to_collection($collection, $app['phraseanet.appbox']);
                     }
                 }
             }
         }
         $ret = ['success' => true, 'message' => $app->trans('Records have been successfuly moved')];
     } catch (\Exception $e) {
         $ret = ['success' => false, 'message' => $app->trans('An error occured')];
     }
     return $app->json($ret);
 }
开发者ID:nlegoff,项目名称:Phraseanet,代码行数:35,代码来源:MoveCollection.php


示例8: includes

 /**
  * Itterate over object, build a relations, fillable and includes collection.
  *
  * @param model $object the model to iterate over
  *
  * @return array
  */
 private function includes($object)
 {
     $fillable = $object->getFillable();
     $includes = $object->getIncludes();
     $table = $object->getTable();
     $columns = $object->columns();
     $results[$table] = [];
     if (!empty($includes)) {
         foreach ($includes as $include) {
             $results[$table] = ['object' => $object, 'includes' => $this->includes(new $include())];
         }
     }
     $this->fillables->put($table, $fillable);
     $this->includes->push($table, $table);
     $this->columns->put($table, $columns);
     return $results;
 }
开发者ID:askedio,项目名称:laravel-cruddy,代码行数:24,代码来源:ApiObjects.php


示例9: getReference

 public function getReference()
 {
     $collection = collection::forClass($this->_className)->select();
     if (null != $this->_model) {
         $this->_model->save();
     }
     $id = $this->getId();
     return \MongoDBRef::create($collection->getName(), $id, (string) $collection->db);
 }
开发者ID:ExceptVL,项目名称:kanon-mongo,代码行数:9,代码来源:reference.php


示例10: append

 /**
 		@brief		Appends a new html string to the collection.
 		@since		2014-05-04 13:08:18
 	**/
 public function append($item)
 {
     $args = func_get_args();
     $text = @call_user_func_array('sprintf', $args);
     if ($text == '') {
         $text = $args[0];
     }
     return parent::append($text);
 }
开发者ID:Garth619,项目名称:wines-by-jennifer,代码行数:13,代码来源:html.php


示例11: list_collection

function list_collection($coll, $collection_list, $nav_bar)
{
    global $collection_list_tmpl;
    global $charset;
    $collection_list_tmpl = str_replace("!!cle!!", $coll, $collection_list_tmpl);
    $collection_list_tmpl = str_replace("!!list!!", $collection_list, $collection_list_tmpl);
    $collection_list_tmpl = str_replace("!!nav_bar!!", $nav_bar, $collection_list_tmpl);
    collection::search_form();
    print pmb_bidi($collection_list_tmpl);
}
开发者ID:hogsim,项目名称:PMB,代码行数:10,代码来源:collections_list.inc.php


示例12: 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


示例13: collectionLocal

 /**
  * Constructor
  * @param object $dilps as reference
  */
 function collectionLocal(&$dilps)
 {
     /**
      * for use of $db and $db_prefix in loadImgData
      */
     parent::collection($dilps);
     $sql = 'SELECT * FROM ' . $dilps->db_prefix . 'collection where host = "local" and active = 1';
     $result = $dilps->db->Execute($sql);
     while (!$result->EOF) {
         $this->addCollId($result->fields['collectionid']);
         $result->MoveNext();
     }
 }
开发者ID:BackupTheBerlios,项目名称:dilps,代码行数:17,代码来源:collectionLocal.class.php


示例14: doJob

 /**
  * {@inheritdoc}
  */
 protected function doJob(JobData $data)
 {
     $app = $data->getApplication();
     $task = $data->getTask();
     $settings = simplexml_load_string($task->getSettings());
     $baseId = (string) $settings->base_id;
     $collection = \collection::get_from_base_id($app, $baseId);
     $collection->empty_collection(200);
     if (0 === $collection->get_record_amount()) {
         $this->stop();
         $this->dispatcher->dispatch(JobEvents::FINISHED, new JobFinishedEvent($task));
     }
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:16,代码来源:EmptyCollectionJob.php


示例15: processData

 private function processData(Application $app, $row, $logsql)
 {
     $databox = $app['phraseanet.appbox']->get_databox($row['sbas_id']);
     $rec = $databox->get_record($row['record_id']);
     switch ($row['action']) {
         case 'UPDATE':
             // change collection ?
             if (array_key_exists('coll', $row)) {
                 $coll = \collection::get_from_coll_id($app, $databox, $row['coll']);
                 $rec->move_to_collection($coll, $app['phraseanet.appbox']);
                 $app['phraseanet.SE']->updateRecord($rec);
                 if ($logsql) {
                     $this->log('debug', sprintf("on sbas %s move rid %s to coll %s \n", $row['sbas_id'], $row['record_id'], $coll->get_coll_id()));
                 }
             }
             // change sb ?
             if (array_key_exists('sb', $row)) {
                 $status = str_split($rec->get_status());
                 foreach (str_split(strrev($row['sb'])) as $bit => $val) {
                     if ($val == '0' || $val == '1') {
                         $status[31 - $bit] = $val;
                     }
                 }
                 $rec->set_binary_status(implode('', $status));
                 $app['phraseanet.SE']->updateRecord($rec);
                 if ($logsql) {
                     $this->log('debug', sprintf("on sbas %s set rid %s status to %s \n", $row['sbas_id'], $row['record_id'], $status));
                 }
             }
             break;
         case 'DELETE':
             if ($row['deletechildren'] && $rec->is_grouping()) {
                 foreach ($rec->get_children() as $child) {
                     $child->delete();
                     $app['phraseanet.SE']->removeRecord($child);
                     if ($logsql) {
                         $this->log('debug', sprintf("on sbas %s delete (grp child) rid %s \n", $row['sbas_id'], $child->get_record_id()));
                     }
                 }
             }
             $rec->delete();
             $app['phraseanet.SE']->removeRecord($rec);
             if ($logsql) {
                 $this->log('debug', sprintf("on sbas %s delete rid %s \n", $row['sbas_id'], $rec->get_record_id()));
             }
             break;
     }
     return $this;
 }
开发者ID:romainneutron,项目名称:Phraseanet,代码行数:49,代码来源:RecordMoverJob.php


示例16: get_io_id

function get_io_id($id)
{
    if ($id > 0) {
        $rubrics = new collection();
        $rubrics->Load(TABLE_RUBRICATOR, false, $where);
        $rubrics = $rubrics->_collection;
        for ($i = 0; $i < count($rubrics); $i++) {
            if ($id == $rubrics[$i]->id) {
                if ($rubrics[$i]->id_io_object > 0) {
                    return $rubrics[$i]->id_io_object;
                } else {
                    if ($rubrics[$i]->id_parent > 0) {
                        return get_io_id($rubrics[$i]->id_parent);
                    } else {
                        return 0;
                    }
                }
            }
        }
        return 0;
    } else {
        return 0;
    }
}
开发者ID:YuriyRusinov,项目名称:reper,代码行数:24,代码来源:edit.php


示例17: 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


示例18: 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


示例19: __construct

 /**
  * Constructor
  */
 protected function __construct()
 {
     global $section;
     parent::__construct(__FILE__);
     // create mailer support
     $system_mailer = new ContactForm_SystemMailer($this->language);
     $smtp_mailer = new ContactForm_SmtpMailer($this->language);
     $this->registerMailer('system', $system_mailer);
     $this->registerMailer('smtp', $smtp_mailer);
     // configure SMTP mailer
     $smtp_mailer->set_server($this->settings['smtp_server'], $this->settings['smtp_port'], $this->settings['use_ssl']);
     if ($this->settings['smtp_authenticate']) {
         $smtp_mailer->set_credentials($this->settings['smtp_username'], $this->settings['smtp_password']);
     }
     // register backend
     if ($section == 'backend' && class_exists('backend')) {
         $backend = backend::getInstance();
         $contact_menu = new backend_MenuItem($this->getLanguageConstant('menu_contact'), url_GetFromFilePath($this->path . 'images/icon.svg'), 'javascript:void(0);', $level = 5);
         $contact_menu->addChild('', new backend_MenuItem($this->getLanguageConstant('menu_manage_forms'), url_GetFromFilePath($this->path . 'images/forms.svg'), window_Open('contact_forms', 600, $this->getLanguageConstant('title_forms_manage'), true, true, backend_UrlMake($this->name, 'forms_manage')), $level = 5));
         $contact_menu->addChild('', new backend_MenuItem($this->getLanguageConstant('menu_manage_templates'), url_GetFromFilePath($this->path . 'images/templates.svg'), window_Open('contact_form_templates', 550, $this->getLanguageConstant('title_templates_manage'), true, true, backend_UrlMake($this->name, 'templates_manage')), $level = 5));
         $contact_menu->addSeparator(5);
         $contact_menu->addChild('', new backend_MenuItem($this->getLanguageConstant('menu_settings'), url_GetFromFilePath($this->path . 'images/settings.svg'), window_Open('contact_form_settings', 400, $this->getLanguageConstant('title_settings'), true, true, backend_UrlMake($this->name, 'settings_show')), $level = 5));
         $contact_menu->addSeparator(5);
         $contact_menu->addChild('', new backend_MenuItem($this->getLanguageConstant('menu_submissions'), url_GetFromFilePath($this->path . 'images/submissions.svg'), window_Open('contact_form_submissions', 650, $this->getLanguageConstant('title_submissions'), true, true, backend_UrlMake($this->name, 'submissions')), $level = 5));
         $backend->addMenu($this->name, $contact_menu);
         // add backend support script
         $head_tag = head_tag::getInstance();
         $head_tag->addTag('script', array('src' => url_GetFromFilePath($this->path . 'include/backend.js'), 'type' => 'text/javascript'));
         $head_tag->addTag('link', array('href' => url_GetFromFilePath($this->path . 'include/backend.css'), 'rel' => 'stylesheet', 'type' => 'text/css'));
     }
     if (class_exists('collection') && $section != 'backend') {
         $collection = collection::getInstance();
         $collection->includeScript(collection::DIALOG);
         $collection->includeScript(collection::COMMUNICATOR);
     }
     if (class_exists('head_tag') && $section != 'backend') {
         $head_tag = head_tag::getInstance();
         $head_tag->addTag('script', array('src' => url_GetFromFilePath($this->path . 'include/contact_form.js'), 'type' => 'text/javascript'));
         $head_tag->addTag('link', array('href' => url_GetFromFilePath($this->path . 'include/contact_form.css'), 'rel' => 'stylesheet', 'type' => 'text/css'));
     }
 }
开发者ID:tareqy,项目名称:Caracal,代码行数:44,代码来源:contact_form.php


示例20: apply

 /**
  * {@inheritdoc}
  */
 public function apply(base $appbox, Application $app)
 {
     $em = $app['orm.em'];
     $sql = "SELECT date_modif, usr_id, base_id, en_cours, refuser\n                FROM demand";
     $rsm = new ResultSetMapping();
     $rsm->addScalarResult('base_id', 'base_id');
     $rsm->addScalarResult('en_cours', 'en_cours');
     $rsm->addScalarResult('refuser', 'refuser');
     $rsm->addScalarResult('usr_id', 'usr_id');
     $rsm->addScalarResult('date_modif', 'date_modif');
     $rs = $em->createNativeQuery($sql, $rsm)->getResult();
     $n = 0;
     foreach ($rs as $row) {
         try {
             $user = $em->createQuery('SELECT PARTIAL u.{id} FROM Phraseanet:User s WHERE u.id = :id')->setParameters(['id' => $row['usr_id']])->setHint(Query::HINT_FORCE_PARTIAL_LOAD, true)->getSingleResult();
         } catch (NoResultException $e) {
             $app['monolog']->addInfo(sprintf('Patch %s : Registration for user (%s) could not be turn into doctrine entity as user could not be found.', $this->get_release(), $row['usr_id']));
             continue;
         }
         try {
             $collection = \collection::get_from_base_id($app, $row['base_id']);
         } catch (\Exception $e) {
             $app['monolog']->addInfo(sprintf('Patch %s : Registration for user (%s) could not be turn into doctrine entity as base with id (%s) could not be found.', $this->get_release(), $row['usr_id'], $row['base_id']));
             continue;
         }
         $registration = new Registration();
         $registration->setCollection($collection);
         $registration->setUser($user);
         $registration->setPending($row['en_cours']);
         $registration->setCreated(new \DateTime($row['date_modif']));
         $registration->setRejected($row['refuser']);
         if ($n % 100 === 0) {
             $em->flush();
             $em->clear();
         }
         $n++;
     }
     $em->flush();
     $em->clear();
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:43,代码来源:390alpha13a.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP comment类代码示例发布时间:2022-05-23
下一篇:
PHP collatorlib类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap