mirror of
https://github.com/processwire/processwire.git
synced 2025-08-24 15:23:11 +02:00
Add error message to resolve issue processwire/processwire-issues#786
This commit is contained in:
@@ -163,6 +163,15 @@ class PageFinder extends Wire {
|
|||||||
protected $sortsAfter = array(); // apply these sorts after pages loaded
|
protected $sortsAfter = array(); // apply these sorts after pages loaded
|
||||||
protected $reverseAfter = false; // reverse order after load?
|
protected $reverseAfter = false; // reverse order after load?
|
||||||
protected $pageArrayData = array(); // any additional data that should be populated back to any resulting PageArray objects
|
protected $pageArrayData = array(); // any additional data that should be populated back to any resulting PageArray objects
|
||||||
|
protected $singlesFields = array( // fields that can only be used by themselves (not OR'd with other fields)
|
||||||
|
'has_parent',
|
||||||
|
'hasParent',
|
||||||
|
'num_children',
|
||||||
|
'numChildren',
|
||||||
|
'children.count',
|
||||||
|
'limit',
|
||||||
|
'start',
|
||||||
|
);
|
||||||
|
|
||||||
// protected $extraSubSelectors = array(); // subselectors that are added in after getQuery()
|
// protected $extraSubSelectors = array(); // subselectors that are added in after getQuery()
|
||||||
// protected $extraJoins = array();
|
// protected $extraJoins = array();
|
||||||
@@ -2309,12 +2318,32 @@ class PageFinder extends Wire {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected function arrangeFields(array $fields) {
|
protected function arrangeFields(array $fields) {
|
||||||
|
|
||||||
$custom = array();
|
$custom = array();
|
||||||
$native = array();
|
$native = array();
|
||||||
|
$singles = array();
|
||||||
|
|
||||||
foreach($fields as $name) {
|
foreach($fields as $name) {
|
||||||
if($this->wire('fields')->isNative($name)) $native[] = $name;
|
if($this->wire('fields')->isNative($name)) {
|
||||||
else $custom[] = $name;
|
$native[] = $name;
|
||||||
|
} else {
|
||||||
|
$custom[] = $name;
|
||||||
|
}
|
||||||
|
if(in_array($name, $this->singlesFields)) {
|
||||||
|
$singles[] = $name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(count($singles) && count($fields) > 1) {
|
||||||
|
// field in use that may no be combined with others
|
||||||
|
if($this->wire('config')->debug || $this->wire('config')->installed > 1549299319) {
|
||||||
|
// debug mode or anything installed after February 4th, 2019
|
||||||
|
$f = reset($singles);
|
||||||
|
$fs = implode('|', $fields);
|
||||||
|
throw new PageFinderSyntaxException("Field '$f' cannot OR with other fields in '$fs'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return array_merge($native, $custom);
|
return array_merge($native, $custom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user