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


PHP Object::find方法代码示例

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


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

示例1: test_addGet

 /**
  * Test adding and getting back class
  *
  * @return void
  * @author Dan Cox
  */
 public function test_addGet()
 {
     $arr = array('task' => array('name' => 'Command', 'description' => '', 'actions' => ['main', 'run']), 'class' => 'TEST');
     $this->library->add($arr);
     // Now find this by its command name
     $val = $this->library->find('Command:run');
     $this->assertEquals('TEST', $val);
 }
开发者ID:danzabar,项目名称:phalcon-cli,代码行数:14,代码来源:TaskLibraryTest.php

示例2: deactivate

 /**
  * Deactivate a module
  *
  * @return void
  * @author Dan Cox
  */
 public function deactivate($name)
 {
     $module = $this->library->find($name);
     if (!is_null($module)) {
         $probe = $this->get('moduleprobe');
         $probe->load($module);
         $probe->deactivateModule();
         return true;
     }
     throw new \Exception("Unable to find this module in the library");
 }
开发者ID:danzabar,项目名称:alice,代码行数:17,代码来源:Modules.php

示例3: first

 /**
  * Finds the first entity by the given parameters
  *
  * @param integer|array|string $param
  * @return Object $entity
  */
 public function first($params, $value = null)
 {
     if (is_numeric($params)) {
         $entity = $this->entity->find($id);
     }
     if (is_array($params)) {
         $entity = $this->entity->where($params)->first();
     }
     if (is_string($params)) {
         $entity = $this->entity->where($params, $value)->first();
     }
     return $entity;
 }
开发者ID:puggin,项目名称:pugs,代码行数:19,代码来源:Repository.php

示例4: beforeSave

 /**
  * Before save
  *
  * @param ObjectModel $model
  * @return boolean true
  */
 public function beforeSave(&$model)
 {
     if (is_numeric($this->Model->id)) {
         $this->_action = 'edit';
         $newData = $this->Model->find('first', array('conditions' => array("{$this->Model->name}.id" => $this->Model->data[$this->Model->name]['id'])));
         foreach ($newData[$this->Model->name] as $input => $value) {
             $this->_oldData .= "{$input} :: {$value}";
         }
     } else {
         $this->_action = 'add';
     }
     return true;
 }
开发者ID:alextalha,项目名称:sg,代码行数:19,代码来源:Logs.php

示例5: blogBlogPostsBeforeRender

 /**
  * blogBlogPostBeforeRender
  * 
  * @param CakeEvent $event
  */
 public function blogBlogPostsBeforeRender(CakeEvent $event)
 {
     if (!BcUtil::isAdminSystem()) {
         return;
     }
     $View = $event->subject();
     if (in_array($View->request->params['action'], $this->targetAction)) {
         $this->setUpModel();
         $data = $this->KeywordConfigModel->find('first', array('conditions' => array('KeywordConfig.model' => 'BlogContent', 'KeywordConfig.content_id' => $View->viewVars['blogContent']['BlogContent']['id'])));
         if ($data) {
             $View->request->data['KeywordConfig'] = $data['KeywordConfig'];
         }
     }
 }
开发者ID:ichi280,项目名称:keyword,代码行数:19,代码来源:KeywordViewEventListener.php

示例6: array

 /**
  * Given the list of params in the params array, fetch the object
  * and store the values in the values array
  *
  * @param Object $block         typically a Phone|Email|IM object
  * @param string $blockName     name of the above object
  * @param array  $params        input parameters to find object
  * @param array  $values        output values of the object
  * @param array  $ids           the array that holds all the db ids
  * @param int    $blockCount    number of blocks to fetch
  *
  * @return array of $block objects.
  * @access public
  * @static
  */
 function &getValues(&$block, $blockName, &$params, &$values, &$ids, $blockCount = 0)
 {
     $block->copyValues($params);
     $flatten = false;
     if (empty($blockCount)) {
         $blockCount = 1;
         $flatten = true;
     } else {
         $values[$blockName] = array();
         $ids[$blockName] = array();
     }
     $blocks = array();
     // we first get the primary location due to the order by clause
     $block->orderBy('is_primary desc');
     $block->find();
     for ($i = 0; $i < $blockCount; $i++) {
         if ($block->fetch()) {
             if ($flatten) {
                 CRM_Core_DAO::storeValues($block, $values);
                 $ids[$blockName] = $block->id;
             } else {
                 $values[$blockName][$i + 1] = array();
                 CRM_Core_DAO::storeValues($block, $values[$blockName][$i + 1]);
                 $ids[$blockName][$i + 1] = $block->id;
             }
             $blocks[$i + 1] = clone $block;
         }
     }
     return $blocks;
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:45,代码来源:Block.php

示例7: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $Object = Object::find($id);
     $Object->name = Input::get('name');
     $Object->save();
     //return Redirect::route('index');
     return Response::json($Object);
 }
开发者ID:nexus1975,项目名称:backend,代码行数:14,代码来源:ObjectsController.php

示例8: cutFanCount

 /**
  * update.
  *
  * @param Int   $accountId Account ID
  * @param Int   $addId     加粉丝的组自增ID
  * @param array $groupIds  粉丝组group_id
  * @param array $count     数量
  */
 public function cutFanCount($accountId, $addId, $groupIds, $count)
 {
     /*
      * 增加
      */
     $addFanGroup = $this->model->find($addId);
     $_saveAddInfo['fan_count'] = $addFanGroup->fan_count + $count;
     $this->_savePost($addFanGroup, $_saveAddInfo);
     /*
      * 减掉
      */
     foreach ($groupIds as $groupId => $groupCount) {
         $cutFanGroup = $this->getGroupByGroupid($accountId, $groupId);
         $_saveCutInfo['fan_count'] = $cutFanGroup->fan_count - $groupCount;
         $this->_savePost($cutFanGroup, $_saveCutInfo);
     }
 }
开发者ID:renyang9876,项目名称:viease,代码行数:25,代码来源:FanGroupRepository.php

示例9: run

 public function run()
 {
     /*{{{*/
     if (class_exists($this->controller)) {
         $instance = Object::find($this->controller);
     } else {
         throw new QException(100);
     }
     if (method_exists($instance, $this->action)) {
         $action = $this->action;
     } else {
         throw new QException(101);
     }
     if (method_exists($instance, $this->_prefix_method)) {
         $instance->dispatch($this->_prefix_method);
     }
     $instance->dispatch($action);
     if (method_exists($instance, $this->_suffix_method)) {
         $instance->dispatch($this->_suffix_method);
     }
 }
开发者ID:pangudashu,项目名称:samframe,代码行数:21,代码来源:Web.php

示例10: formatArgs

 /**
  * Format the arguments into a useable state
  *
  * @return Array
  */
 public function formatArgs($args)
 {
     // The first argument is always the file
     unset($args[0]);
     if (isset($args[1])) {
         $command = explode(':', $args[1]);
         unset($args[1]);
     } else {
         // No Command Specified.
         return array();
     }
     try {
         $action = isset($command[1]) ? $command[1] : 'main';
         $cmd = $this->library->find($command[0] . ':' . $action);
         $task = get_class($cmd);
         return array('task' => $task, 'action' => $action, 'params' => $args);
     } catch (\Exception $e) {
         // No Command FOUND
         return array();
     }
 }
开发者ID:danzabar,项目名称:phalcon-cli,代码行数:26,代码来源:Application.php

示例11: _generateContentSaveData

 /**
  * 保存するデータの生成
  * 
  * @param Object $Model
  * @param int $contentId
  * @return array
  */
 private function _generateContentSaveData($Model, $contentId)
 {
     $params = Router::getParams();
     $this->PetitBlogCustomFieldConfigModel = ClassRegistry::init('PetitBlogCustomField.PetitBlogCustomFieldConfig');
     $data = array();
     if ($Model->alias == 'BlogContent') {
         $modelId = $contentId;
         $oldModelId = $params['pass'][0];
     }
     if ($contentId) {
         $data = $this->PetitBlogCustomFieldConfigModel->find('first', array('conditions' => array('PetitBlogCustomFieldConfig.blog_content_id' => $contentId)));
     }
     if ($params['action'] != 'admin_ajax_copy') {
         if ($data) {
             // 編集時
             $data['PetitBlogCustomFieldConfig'] = array_merge($data['PetitBlogCustomFieldConfig'], $Model->data['PetitBlogCustomFieldConfig']);
         } else {
             // 追加時
             $data['PetitBlogCustomFieldConfig']['blog_content_id'] = $contentId;
         }
     } else {
         // Ajaxコピー処理時に実行
         // ブログコピー保存時にエラーがなければ保存処理を実行
         if (empty($Model->validationErrors)) {
             $_data = $this->PetitBlogCustomFieldConfigModel->find('first', array('conditions' => array('PetitBlogCustomFieldConfig.blog_content_id' => $oldModelId), 'recursive' => -1));
             // XXX もしキーワード設定の初期データ作成を行ってない事を考慮して判定している
             if ($_data) {
                 // コピー元データがある時
                 $data['PetitBlogCustomFieldConfig']['blog_content_id'] = $contentId;
                 unset($data['PetitBlogCustomFieldConfig']['id']);
             } else {
                 // コピー元データがない時
                 $data['PetitBlogCustomFieldConfig']['blog_content_id'] = $modelId;
             }
         }
     }
     return $data;
 }
开发者ID:gondoh,项目名称:petit_blog_custom_field,代码行数:45,代码来源:PetitBlogCustomFieldModelEventListener.php

示例12: prepareActivityLog

 public static function prepareActivityLog($shareData)
 {
     $aApp = array(App::SHARECALENDAR => 'calendar', App::SHAREEVENT => 'calendar', App::SHARETODO => App::SHARECALENDAR);
     //shared_with_by, shared_user_self,shared_group_self,shared_link_self
     if (array_key_exists($shareData['itemType'], $aApp)) {
         $sType = '';
         $sL10nDescr = '';
         if ($shareData['itemType'] === App::SHARECALENDAR) {
             $sType = App::SHARECALENDARPREFIX;
             $sL10nDescr = 'calendar';
         }
         if ($shareData['itemType'] === App::SHAREEVENT) {
             $sType = App::SHAREEVENTPREFIX;
             $sL10nDescr = 'event';
         }
         if ($shareData['itemType'] === App::SHARETODO) {
             $sType = App::SHARETODOPREFIX;
             $sL10nDescr = 'todo';
         }
         $sApp = $aApp[$shareData['itemType']];
         $l = \OC::$server->getL10N(App::$appname);
         $type = 'shared_' . $sApp;
         if ($shareData['token'] !== '' && $shareData['shareType'] === \OCP\Share::SHARE_TYPE_LINK) {
             $shareData['itemSource'] = App::validateItemSource($shareData['itemSource'], $sType);
             if ($shareData['itemType'] === App::SHAREEVENT || $shareData['itemType'] === App::SHARECALENDAR) {
                 $link = \OC::$server->getURLGenerator()->linkToRoute(App::$appname . '.public.index', ['token' => $shareData['token']]);
             }
             if ($shareData['itemType'] === App::SHARETODO) {
                 $link = \OC::$server->getURLGenerator()->linkToRoute('tasksplus.public.index', ['token' => $shareData['token']]);
             }
             if ($shareData['itemType'] === App::SHAREEVENT || $shareData['itemType'] === App::SHARETODO) {
                 $aObject = Object::find($shareData['itemSource']);
                 $aCalendar = Calendar::find($aObject['calendarid']);
                 $description = $l->t($sL10nDescr) . ' ' . $aObject['summary'] . ' (' . $l->t('calendar') . ' ' . $aCalendar['displayname'] . ')';
             } else {
                 $description = $l->t($sL10nDescr) . ' ' . $shareData['itemTarget'];
             }
             \OC::$server->getActivityManager()->publishActivity(App::$appname, 'shared_link_self_' . $sApp, array($description), '', '', '', $link, \OCP\User::getUser(), $type, '');
         }
         if ($shareData['shareType'] === \OCP\Share::SHARE_TYPE_USER) {
             $link = '';
             $shareData['itemSource'] = App::validateItemSource($shareData['itemSource'], $sType);
             if ($shareData['itemType'] === App::SHARETODO) {
                 $link = \OC::$server->getURLGenerator()->linkToRoute('tasksplus.page.index') . '#' . urlencode($shareData['itemSource']);
             }
             if ($shareData['itemType'] === App::SHAREEVENT) {
                 $link = \OC::$server->getURLGenerator()->linkToRoute(App::$appname . '.page.index') . '#' . urlencode($shareData['itemSource']);
             }
             $description = $shareData['itemTarget'];
             if ($shareData['itemType'] === App::SHARETODO || $shareData['itemType'] === App::SHAREEVENT) {
                 $aObject = Object::find($shareData['itemSource']);
                 $aCalendar = Calendar::find($aObject['calendarid']);
                 $description = $aObject['summary'] . ' (' . $l->t('calendar') . ' ' . $aCalendar['displayname'] . ')';
             }
             \OC::$server->getActivityManager()->publishActivity(App::$appname, 'shared_user_self_' . $sApp, array($l->t($sL10nDescr) . ' ' . $description, $shareData['shareWith']), '', '', '', $link, \OCP\User::getUser(), $type, '');
             \OC::$server->getActivityManager()->publishActivity(App::$appname, 'shared_with_by_' . $sApp, array($l->t($sL10nDescr) . ' ' . $description, \OCP\User::getUser()), '', '', '', $link, $shareData['shareWith'], $type, '');
         }
         if ($shareData['shareType'] === \OCP\Share::SHARE_TYPE_GROUP) {
             $link = '';
             $shareData['itemSource'] = App::validateItemSource($shareData['itemSource'], $sType);
             if ($shareData['itemType'] === App::SHARETODO) {
                 $link = \OC::$server->getURLGenerator()->linkToRoute('tasksplus.page.index') . '#' . urlencode($shareData['itemSource']);
             }
             if ($shareData['itemType'] === App::SHAREEVENT) {
                 $link = \OC::$server->getURLGenerator()->linkToRoute('calendar.page.index') . '#' . urlencode($shareData['itemSource']);
             }
             $description = $shareData['itemTarget'];
             if ($shareData['itemType'] === App::SHARETODO || $shareData['itemType'] === App::SHAREEVENT) {
                 $aObject = Object::find($shareData['itemSource']);
                 $aCalendar = Calendar::find($aObject['calendarid']);
                 $description = $aObject['summary'] . ' (' . $l->t('calendar') . ' ' . $aCalendar['displayname'] . ')';
             }
             \OC::$server->getActivityManager()->publishActivity(App::$appname, 'shared_group_self_' . $sApp, array($l->t($sL10nDescr) . ' ' . $description, $shareData['shareWith']), '', '', '', $link, \OCP\User::getUser(), $type, '');
             $usersInGroup = \OC_Group::usersInGroup($shareData['shareWith']);
             foreach ($usersInGroup as $user) {
                 \OC::$server->getActivityManager()->publishActivity(App::$appname, 'shared_with_by_' . $sApp, array($l->t($sL10nDescr) . ' ' . $description, \OCP\User::getUser()), '', '', '', $link, $user, 'shared_' . $sApp, '');
             }
         }
     }
 }
开发者ID:Rotzbua,项目名称:calendarplus,代码行数:80,代码来源:hooks.php

示例13: getAction

 public function getAction()
 {
     /*{{{*/
     $web = Object::find("Web");
     return $web->action;
 }
开发者ID:pangudashu,项目名称:samframe,代码行数:6,代码来源:Controller.php

示例14: isDuplicate

    private function isDuplicate($insertid)
    {
        $newobject = Object::find($insertid);
        $endDate = $newobject['enddate'];
        if (!$newobject['enddate']) {
            $endDate = null;
        }
        $stmt = \OCP\DB::prepare('SELECT COUNT(*) AS `COUNTING` FROM `' . App::CldObjectTable . '` `CO`
								 INNER JOIN `' . App::CldCalendarTable . '` ON `CO`.`calendarid`=`' . App::CldCalendarTable . '`.`id`
								 WHERE `CO`.`objecttype`=? AND `CO`.`startdate`=? AND `CO`.`enddate`=? AND `CO`.`repeating`=? AND `CO`.`summary`=? AND `CO`.`calendardata`=? AND `' . App::CldCalendarTable . '`.`userid` = ? AND `CO`.`calendarid`=?');
        $result = $stmt->execute(array($newobject['objecttype'], $newobject['startdate'], $endDate, $newobject['repeating'], $newobject['summary'], $newobject['calendardata'], $this->userid, $newobject['calendarid']));
        $result = $result->fetchRow();
        if ($result['COUNTING'] >= 2) {
            return true;
        }
        return false;
    }
开发者ID:Rotzbua,项目名称:calendarplus,代码行数:17,代码来源:import.php

示例15: sortby

 /**
  * Take in an order array and sorts the list based on that order specification
  * and creates new weights for it. If no foreign key is supplied, all lists
  * will be sorted.
  *
  * @todo foreign key independent
  * @param Object $Model
  * @param array $order
  * @param mixed $foreign_key
  * $returns boolean true if successfull
  */
 public function sortby(&$Model, $order, $foreign_key = null)
 {
     $fields = array($Model->primaryKey, $this->settings[$Model->alias]['field']);
     $conditions = array(1 => 1);
     if ($this->settings[$Model->alias]['foreign_key']) {
         if (!$foreign_key) {
             return false;
         }
         $fields[] = $this->settings[$Model->alias]['foreign_key'];
         $conditions = array($Model->alias . '.' . $this->settings[$Model->alias]['foreign_key'] => $foreign_key);
     }
     $all = $Model->find('all', array('fields' => $fields, 'conditions' => $conditions, 'recursive' => -1, 'order' => $order));
     $i = 1;
     foreach ($all as $key => $one) {
         $all[$key][$Model->alias][$this->settings[$Model->alias]['field']] = $i++;
     }
     return $Model->saveAll($all);
 }
开发者ID:vuthaiphat,项目名称:CakePHP-Assets,代码行数:29,代码来源:ordered.php


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