本文整理汇总了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;
}