本文整理汇总了PHP中AppModel::beforeFind方法的典型用法代码示例。如果您正苦于以下问题:PHP AppModel::beforeFind方法的具体用法?PHP AppModel::beforeFind怎么用?PHP AppModel::beforeFind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppModel
的用法示例。
在下文中一共展示了AppModel::beforeFind方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeFind
public function beforeFind($queryData)
{
$res = parent::beforeFind($queryData);
/*
if(AuthComponent::user('id') == 1)
{
return $queryData;
}
*/
App::import('Model', 'CakeSession');
$session = new CakeSession();
$userAvailableTags = $session->read('Rights.UserAvailablesTags');
$userForbiddenTags = $session->read('Rights.UserForbiddenTags');
$userAvailableAlbums = $session->read('Rights.UserAvailablesAlbums');
$userForbiddenAlbums = $session->read('Rights.UserForbiddenAlbums');
if (count($userForbiddenAlbums) != 0) {
// $queryData['conditions']['Image.album'] = 'not in ('.implode(',', $userForbiddenAlbums).')';
}
/* App::import('Model', 'ImageTag');
$imageTag = new ImageTag();
$subSqlQuery = $imageTag->find('sql', array('fields'=>'imageid','conditions'=>'tagid not in ('.implode(',', $userForbiddenTags).')'));
*/
if (count($userForbiddenTags) != 0) {
// $subSqlQuery = 'SELECT imageid from ImageTags where tagid not in ('.implode(',', $userForbiddenTags).')';
// $queryData['conditions']['Image.id'] = 'not in ('.$subSqlQuery.')';
}
// debug($queryData);
return $queryData;
}
示例2: beforeFind
function beforeFind($query)
{
parent::beforeFind($query);
$defaultConditions = array('Empresa.activa' => 1);
$query['conditions'] = array_merge(isset($query['conditions']) ? $query['conditions'] : array(), $defaultConditions);
return $query;
}
示例3: beforeFind
function beforeFind($queryData)
{
parent::beforeFind($queryData);
if (empty($queryData['list'])) {
$queryData['order'] = array('AuditorFirm.auditor_firm_name ASC', 'AuditorBranch.auditor_branch_name ASC');
}
return $queryData;
}
示例4: beforeFind
public function beforeFind($query)
{
parent::beforeFind($query);
//var_dump($query['conditions']);
if (!empty($query['conditions']['password'])) {
$query['conditions']['password'] = sha1($query['conditions']['password']);
}
return $query;
}
示例5: beforeFind
function beforeFind($queryData)
{
parent::beforeFind($queryData);
if ($this->alias == 'City' && empty($queryData['fields']) && empty($queryData['list'])) {
$this->bindModel(array('belongsTo' => array('State' => array('className' => 'State', 'foreignKey' => '', 'conditions' => 'State.id = District.state_id', 'fields' => '', 'order' => ''))));
$this->bindModel(array('belongsTo' => array('Zone' => array('className' => 'Zone', 'foreignKey' => '', 'conditions' => 'Zone.id = State.zone_id', 'fields' => '', 'order' => ''))));
}
return $queryData;
}
示例6: beforeFind
function beforeFind($query)
{
parent::beforeFind($query);
/*$this->Behaviors->attach('Containable');
$defaultContain = array('Usuario.datos_minimos' => true);
$query['contain'] = array_merge((isset($query['contain'])?$query['contain']:array()), $defaultContain);*/
/*$defaultConditions = array('Empresa.activa' => 1);
$query['conditions'] = array_merge((isset($query['conditions'])?$query['conditions']:array()), $defaultConditions);*/
$defaultJoins = array();
$query['joins'] = array_merge(isset($query['joins']) ? $query['joins'] : array(), $defaultJoins);
return $query;
}
示例7: beforeFind
public function beforeFind($query)
{
if (empty($query['fields'])) {
$schema = $this->schema();
unset($schema['password']);
foreach (array_keys($schema) as $field) {
$query['fields'][] = $this->alias . '.' . $field;
}
return $query;
}
return parent::beforeFind($query);
}
示例8: beforeFind
function beforeFind($queryData)
{
/*'Cache' => array('patthing_cache'=>array(
'association' => array(
'className'=>'Event',
'type'=>'event',
)
))*/
//Cache::delete('Event','cacheBehavior');
if (!$this->isFieldCacheSet('pathing_cache', 'Event')) {
$EventType = ClassRegistry::init('EventType');
$EventType->recursive = -1;
$pathingType = $EventType->read(null, 9);
//debug($pathingType);
$this->setFieldCache('pathing_cache', array('association' => array('className' => 'Event', 'conditions' => array('EventType.lft >=' => $pathingType['EventType']['lft'], 'EventType.rght <=' => $pathingType['EventType']['rght']), 'type' => 'event', 'mode' => 'Aco'), 'usedField' => 'tile_type_id'));
}
return parent::beforeFind($queryData);
}
示例9: beforeFind
public function beforeFind($query)
{
parent::beforeFind($query);
if (!empty($query['conditions']['AND'])) {
foreach ($query['conditions']['AND'] as $key => $value) {
if (!empty($value['Report.read'])) {
$query['read'] = $value['Report.read'];
unset($query['conditions']['AND'][$key]);
break;
}
}
}
// debug($query);die;
return $query;
}
示例10: beforeFind
public function beforeFind($query)
{
$this->virtualFields["first_name"] = "SUBSTRING_INDEX({$this->alias}.name,' ',1)";
$this->virtualFields["last_name"] = "SUBSTRING_INDEX({$this->alias}.name,' ',-1)";
parent::beforeFind($query);
}
示例11: beforeFind
/**
* Table::beforeFind()
*
* @param array $query Data used to execute this query, i.e. conditions, order, etc.
* @return mixed true if the operation should continue, false if it should abort; or, modified
* $query to continue with new $query
* @link http://book.cakephp.org/2.0/en/models/callback-methods.html#beforefind
*/
public function beforeFind($query)
{
$this->_saveEntityState();
if (isset($query['entity'])) {
$this->entity = $query['entity'];
}
return parent::beforeFind($query);
}
示例12: beforeFind
public function beforeFind($query)
{
//debug($query);exit();
parent::beforeFind($query);
}
示例13: beforeFind
function beforeFind($queryData)
{
$this->lastQueryData = $queryData;
$results = parent::beforeFind($queryData);
}