本文整理匯總了PHP中Cake\ORM\Query::innerJoinWith方法的典型用法代碼示例。如果您正苦於以下問題:PHP Query::innerJoinWith方法的具體用法?PHP Query::innerJoinWith怎麽用?PHP Query::innerJoinWith使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Cake\ORM\Query
的用法示例。
在下文中一共展示了Query::innerJoinWith方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: search
/**
* {@inheritDoc}
*
* It looks for search-criteria and applies them over the query object. For
* example, given the criteria below:
*
* "this phrase" -"and not this one"
*
* Alters the query object as follow:
*
* ```php
* $query->where([
* 'indexed_words LIKE' => '%this phrase%',
* 'indexed_words NOT LIKE' => '%and not this one%'
* ]);
* ```
*
* The `AND` & `OR` keywords are allowed to create complex conditions. For
* example:
*
* "this phrase" OR -"and not this one" AND "this"
*
* Will produce something like:
*
* ```php
* $query->where(['indexed_words LIKE' => '%this phrase%'])
* ->orWhere(['indexed_words NOT LIKE' => '%and not this one%']);
* ->andWhere(['indexed_words LIKE' => '%this%']);
* ```
*/
public function search($criteria, Query $query)
{
$tokens = (array) (new MiniLanguageParser($criteria))->parse();
if (!empty($tokens)) {
$query->innerJoinWith('SearchDatasets');
foreach ($tokens as $token) {
if ($token->isOperator()) {
$query = $this->_scopeOperator($query, $token);
} else {
$query = $this->_scopeWords($query, $token);
}
}
}
return $query;
}