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


PHP AppModel::find方法代码示例

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


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

示例1: find

 public static function find($id)
 {
     $row = parent::find($id, UserModel::get_table_name());
     $um = new UserModel($row["first_name"], $row["last_name"], $row["email"], $row["password"], $row["last_login"], $row["failed_login_attempts"], $row["date_created"]);
     $um->id = $row["id"];
     return $um;
 }
开发者ID:spencerbartz,项目名称:horrie_international,代码行数:7,代码来源:user_model.php

示例2: find

 public static function find($id)
 {
     $row = parent::find($id, PageModel::get_table_name());
     $pm = new PageModel($row["page_text"], $row["adventure_id"], $row["image_url"], $row["date_created"]);
     $pm->id = $row["id"];
     return $pm;
 }
开发者ID:spencerbartz,项目名称:horrie_international,代码行数:7,代码来源:page_model.php

示例3: refreshMirror

 /**
  *
  * @param AppModel $model
  */
 public function refreshMirror($model, $checkPendingOperations = false)
 {
     if ($checkPendingOperations) {
         if ($this->_pending[$model->alias] > 0) {
             return;
         }
         $this->_pending[$model->alias] = 0;
     }
     $config = $this->settings[$model->alias];
     if ($model->Behaviors->enabled('Translate')) {
         if ($config['findOptions']['recursive'] >= 0 || $model->Behaviors->Translate->settings[$model->alias]) {
             $oldLang = SlConfigure::read('I18n.lang');
             $locales = SlConfigure::read('I18n.locales');
             $localesPreg = '/_' . implode('$|_', $locales) . '$/';
             foreach ($locales as $lang => $locale) {
                 Sl::setLocale($lang);
                 $data = $model->find($config['findType'], $config['findOptions']);
                 if ($config['collectionField']) {
                     $this->_cleanup($config['name'], $locale);
                 }
                 $this->_write($config['name'], $this->_prepareData($model, $config, $data, $localesPreg), $locale);
             }
             Sl::setLocale($oldLang);
             return;
         }
     }
     $data = $model->find($config['findType'], $config['findOptions']);
     if ($config['collectionField']) {
         $this->_cleanup($config['name']);
     }
     $this->_write($config['name'], $this->_prepareData($model, $config, $data));
 }
开发者ID:sandulungu,项目名称:StarLight,代码行数:36,代码来源:mirrored.php

示例4: find

 public function find($conditions = null, $fields = array(), $order = null, $recursive = null)
 {
     if (isset($this->userType) && $this->userType == 'admin') {
         $this->contain("{$this->User->alias}.Hospital.code");
     }
     return parent::find($conditions, $fields, $order, $recursive);
 }
开发者ID:sathishkumarb,项目名称:HVMS,代码行数:7,代码来源:job.php

示例5:

 function __validateOneUser()
 {
     if (parent::find('count')) {
         return false;
     }
     return true;
 }
开发者ID:rchavik,项目名称:20Couch,代码行数:7,代码来源:user.php

示例6: find

 public function find($type = 'first', $queryData = array())
 {
     $catalog_field = 'backup_catalog';
     $this->hasMany['Dataset']['conditions'][$catalog_field] = '1';
     $queryData = array_merge_recursive(array('order' => array('Datachannel.ord' => 'asc'), 'limit' => 100), $queryData);
     return parent::find($type, $queryData);
 }
开发者ID:slachiewicz,项目名称:_mojePanstwo-API-Server,代码行数:7,代码来源:Datachannel.php

示例7: pingbackRegisterComment

 /**
  * Register pingback comment. Used by pingback server
  *
  * @param AppModel $model
  * @param string $modelId
  * @param array $options
  * @param string $sourceUri
  * @param string $targetUri
  * @return boolean
  */
 public function pingbackRegisterComment(&$model, $modelId, $sourceUri, $targetUri)
 {
     extract($this->settings[$model->alias]);
     if ($model->{$commentAlias}->hasAny(array($commentAlias . '.foreign_key' => $modelId, 'author_url' => $sourceUri))) {
         throw new XmlRpcResponseException(0, 'Pingback already registries in system.');
     }
     $sourceBody = $this->loadPageContent($sourceUri);
     if (strpos($sourceBody, $targetUri) === false) {
         throw new XmlRpcResponseException(0, 'Source link is not detected in target blog.');
     }
     $sourceBody = $this->cleanupPage($sourceBody);
     $title = $this->fetchTitle($sourceBody);
     $cite = $this->fetchPingbackCite($sourceBody, $sourceUri, $targetUri);
     $isSpam = false;
     $data = array('comment_type' => 'pingback', 'author_name' => $title . 'blog', 'author_url' => $sourceUri, 'title' => $title, 'foreign_key' => $modelId, 'model' => $model->alias, 'body' => $cite);
     if ($model->{$commentAlias}->Behaviors->enabled('Antispamable')) {
         $isSpam = $model->isSpam();
     }
     $data['is_spam'] = $isSpam ? 'spam' : 'clean';
     $modelData = $model->find('first', array('conditions' => array('id' => $modelId), 'recursive' => -1));
     if (!empty($modelData[$model->alias][$requireApproveModelField])) {
         $data[$requireApproveCommentField] = 0;
     }
     $model->{$commentAlias}->create($data);
     return $model->{$commentAlias}->save();
 }
开发者ID:tetsuo111,项目名称:cakephp,代码行数:36,代码来源:PingbackableBehavior.php

示例8: find

 public static function find($id)
 {
     $row = parent::find($id, AdventureModel::get_table_name());
     $am = new AdventureModel($row["title"], $row["user_id"], $row["date_created"]);
     $am->id = $row["id"];
     return $am;
 }
开发者ID:spencerbartz,项目名称:horrie_international,代码行数:7,代码来源:adventure_model.php

示例9: find

 function find($type = 'first', $queryData = array())
 {
     $this->belongsTo['Folder']['conditions']['Application.enabled'] = '1';
     $fields = array('Application.id', 'Application.slug', 'Application.name', 'Application.plugin', 'Application.type', 'Application.home', 'Folder.id', 'Folder.slug', 'Folder.name', 'Application.folder_id');
     $queryData = array_merge(array('fields' => $fields, 'order' => array(array('Application.ord' => 'asc')), 'limit' => 100, 'conditions' => array('Application.enabled' => '1')), $queryData);
     return parent::find($type, $queryData);
 }
开发者ID:slachiewicz,项目名称:_mojePanstwo-API-Server,代码行数:7,代码来源:Application.php

示例10: find

 public function find($type = 'first', $queryData = array())
 {
     if ($type == 'first' && (($alias = @$queryData['conditions']['Dataset.alias']) || ($alias = @$queryData['conditions']['Dataset.base_alias']))) {
         App::import('model', 'MPCache');
         $this->MPCache = new MPCache();
         $output = $this->MPCache->getDataset($alias, @$queryData['full']);
         if (!empty($output)) {
             $output['orders'] = isset($output['orders_es']) ? $output['orders_es'] : array();
         }
         if (!empty($output['filters'])) {
             foreach ($output['filters'] as &$f) {
                 if (strpos($f['filter']['field'], '.') === false) {
                     $f['filter']['field'] = $alias . '.' . $f['filter']['field'];
                 }
             }
         }
         return $output;
     }
     $fields = array();
     if (isset($queryData['fields'])) {
         $fields = $queryData['fields'];
     } else {
         $fields = array('Dataset.id', 'Dataset.alias', 'Dataset.name', 'Dataset.class', 'Dataset.count', 'Dataset.channel_id', 'Dataset.default_sort', 'Datachannel.id', 'Datachannel.nazwa', 'Datachannel.slug', 'App.id', 'App.name', 'App.plugin', 'App.slug');
     }
     $queryData = array_merge_recursive(array('fields' => $fields, 'limit' => 100), $queryData);
     return parent::find($type, $queryData);
 }
开发者ID:slachiewicz,项目名称:_mojePanstwo-API-Server,代码行数:27,代码来源:Dataset.php

示例11: find

 /**
  * Returns a result set array.
  *
  * Also used to perform new-notation finds, where the first argument is type of find operation to perform
  * (sum / all / first / count / neighbors / list / threaded ),
  * second parameter options for finding ( indexed array, including: 'conditions', 'limit',
  * 'recursive', 'page', 'fields', 'offset', 'order')
  *
  * Eg:
  * {{{
  *	find('all', array(
  *		'conditions' => array('name' => 'Thomas Anderson'),
  * 		'fields' => array('name', 'email'),
  * 		'order' => 'field3 DESC',
  * 		'recursive' => 2,
  * 		'group' => 'type'
  * ));
  * }}}
  *
  * Specifying 'fields' for new-notation 'list':
  *
  *  - If no fields are specified, then 'id' is used for key and 'model->displayField' is used for value.
  *  - If a single field is specified, 'id' is used for key and specified field is used for value.
  *  - If three fields are specified, they are used (in order) for key, value and group.
  *  - Otherwise, first and second fields are used for key and value.
  *
  * @param array $conditions SQL conditions array, or type of find operation (all / first / count / neighbors / list / threaded)
  * @param mixed $fields Either a single string of a field name, or an array of field names, or options for matching
  * @param string $order SQL ORDER BY conditions (e.g. "price DESC" or "name ASC")
  * @param integer $recursive The number of levels deep to fetch associated records
  * @return array Array of records
  * @access public
  * @link http://book.cakephp.org/view/449/find
  */
 function find($conditions = null, $fields = array(), $order = null, $recursive = null)
 {
     if (!empty($conditions)) {
         $conditions = strtolower($conditions);
         if ($conditions == 'sum') {
             $campoAMeter = array('sum("FondosLineasDeAccion"."monto") AS "FondosLineasDeAccion__sum"');
             if (is_array($fields)) {
                 if (!empty($fields['fields'])) {
                     $fields['fields'] = Set::merge($fields['fields'], $campoAMeter);
                 } else {
                     $fields['fields'] = $campoAMeter;
                 }
                 if (!empty($fields['group'])) {
                     $fields['fields'] = Set::merge($fields['fields'], $fields['group']);
                 }
             } elseif (is_string($fields)) {
                 return parent::find($conditions, $fields, $order, $recursive);
             }
             $trajo = parent::find('all', $fields, $order, $recursive);
             if (count($trajo) > 1) {
                 return $trajo;
             } else {
                 return $trajo[0]['FondosLineasDeAccion']['sum'];
             }
         }
     }
     return parent::find($conditions, $fields, $order, $recursive);
 }
开发者ID:Navdeep736,项目名称:regetp01,代码行数:62,代码来源:fondos_lineas_de_accion.php

示例12: find

 public static function find($id)
 {
     $row = parent::find($id, QuestionModel::get_table_name());
     $qm = new QuestionModel($row["page_id"], $row["q_and_a"], $row["date_created"]);
     $qm->id = $row["id"];
     return $qm;
 }
开发者ID:spencerbartz,项目名称:horrie_international,代码行数:7,代码来源:question_model.php

示例13: main

 function main()
 {
     if (empty($this->args)) {
         return $this->err('Usage: ./cake fixturize <table>');
     }
     if ($this->args[0] == '?') {
         return $this->out('Usage: ./cake fixturize <table> [-force] [-reindex]');
     }
     $options = array('force' => false, 'reindex' => false);
     foreach ($this->params as $key => $val) {
         foreach ($options as $name => $option) {
             if (isset($this->params[$name]) || isset($this->params['-' . $name]) || isset($this->params[$name[0]])) {
                 $options[$name] = true;
             }
         }
     }
     foreach ($this->args as $table) {
         $name = Inflector::classify($table);
         $Model = new AppModel(array('name' => $name, 'table' => $table));
         $file = sprintf('%stests/fixtures/%s_fixture.php', APP, Inflector::underscore($name));
         $File = new File($file);
         if ($File->exists() && !$options['force']) {
             $this->err(sprintf('File %s already exists, use --force option.', $file));
             continue;
         }
         $records = $Model->find('all');
         $out = array();
         $out[] = '<?php';
         $out[] = '';
         $out[] = sprintf('class %sFixture extends CakeTestFixture {', $name);
         $out[] = sprintf('	var $name = \'%s\';', $name);
         $out[] = '	var $records = array(';
         $File->write(join("\n", $out));
         foreach ($records as $record) {
             $out = array();
             $out[] = '		array(';
             if ($options['reindex']) {
                 foreach (array('old_id', 'vendor_id') as $field) {
                     if ($Model->hasField($field)) {
                         $record[$name][$field] = $record[$name]['id'];
                         break;
                     }
                 }
                 $record[$name]['id'] = String::uuid();
             }
             foreach ($record[$name] as $field => $val) {
                 $out[] = sprintf('			\'%s\' => \'%s\',', addcslashes($field, "'"), addcslashes($val, "'"));
             }
             $out[] = '		),';
             $File->write(join("\n", $out));
         }
         $out = array();
         $out[] = '	);';
         $out[] = '}';
         $out[] = '';
         $out[] = '?>';
         $File->write(join("\n", $out));
         $this->out(sprintf('-> Create %sFixture with %d records (%d bytes) in "%s"', $name, count($records), $File->size(), $file));
     }
 }
开发者ID:stripthis,项目名称:donate,代码行数:60,代码来源:fixturize.php

示例14: main

 function main()
 {
     if (empty($this->args)) {
         return $this->err('Usage: ./cake uuidize <table>');
     }
     if ($this->args[0] == '?') {
         return $this->out('Usage: ./cake uuidize <table> [-force] [-reindex]');
     }
     $options = array('force' => false, 'reindex' => false);
     foreach ($this->params as $key => $val) {
         foreach ($options as $name => $option) {
             if (isset($this->params[$name]) || isset($this->params['-' . $name]) || isset($this->params[$name[0]])) {
                 $options[$name] = true;
             }
         }
     }
     foreach ($this->args as $table) {
         $name = Inflector::classify($table);
         $Model = new AppModel(array('name' => $name, 'table' => $table));
         $records = $Model->find('all');
         foreach ($records as $record) {
             $Model->updateAll(array('id' => '"' . String::uuid() . '"'), array('id' => $record[$name]['id']));
         }
     }
 }
开发者ID:stripthis,项目名称:donate,代码行数:25,代码来源:uuidize.php

示例15: find

 function find($type = 'first', $options = array())
 {
     if (isset($options['hideSecret']) && $options['hideSecret'] == true) {
         $options['conditions'] = am(@$options['conditions'], array('AND' => array("LOCATE('s', SUBSTRING_INDEX(Channel.defmodes, ' ', 1))" => 0, "LOCATE('p', SUBSTRING_INDEX(Channel.defmodes, ' ', 1))" => 0)));
     }
     unset($options['hideSecret']);
     return parent::find($type, $options);
 }
开发者ID:kouak,项目名称:ircube,代码行数:8,代码来源:channel.php


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