testing search function
This commit is contained in:
parent
55882611e7
commit
fa30f4b0f7
@ -122,38 +122,43 @@ class Product extends Entity {
|
|||||||
if(property_exists($this, $field)) {
|
if(property_exists($this, $field)) {
|
||||||
if(match($values, $this->$field)) {
|
if(match($values, $this->$field)) {
|
||||||
$matches[$field] = $this->$field;
|
$matches[$field] = $this->$field;
|
||||||
|
} else {
|
||||||
|
if($matchAll) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if(array_key_exists($field, $this->get_info())) {
|
} else if(array_key_exists($field, $this->get_info())) {
|
||||||
if(match($values, $this->get_info()[$field])) {
|
if(match($values, $this->get_info()[$field])) {
|
||||||
$matches[$field] = $this->get_info()[$field];
|
$matches[$field] = $this->get_info()[$field];
|
||||||
|
} else {
|
||||||
|
if($matchAll) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if($field == 'tag') {
|
} else if($field == 'tag') {
|
||||||
foreach($this->get_tags() as $tag) {
|
foreach($this->get_tags() as $tag) {
|
||||||
if(match($values, $tag)) {
|
if(match($values, $tag)) {
|
||||||
$matches['tags'] = $this->get_tags();
|
if(!array_key_exists('tags', $matches)) {
|
||||||
|
$matches['tags'] = array();
|
||||||
|
}
|
||||||
|
$matches['tags'][] = $tag;
|
||||||
break;
|
break;
|
||||||
|
} else {
|
||||||
|
if($matchAll) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if($field == 'status') {
|
} else if($field == 'status') {
|
||||||
if(match($values, $this->get_status())) {
|
if(match($values, $this->get_status())) {
|
||||||
$matches['status'] = $this->get_status();
|
$matches['status'] = $this->get_status();
|
||||||
}
|
} else {
|
||||||
}
|
if($matchAll) {
|
||||||
}
|
|
||||||
|
|
||||||
if($matchAll && array_diff_assoc($terms, $matches)) {
|
|
||||||
print('=== DEBUG $terms ===<br>');
|
|
||||||
var_dump($terms);
|
|
||||||
print('<br><br>');
|
|
||||||
print('=== DEBUG diff $terms and $matches ===<br>');
|
|
||||||
var_dump(array_diff_assoc($terms, $matches));
|
|
||||||
print('<br><br>');
|
|
||||||
print('=== DEBUG $matches ===<br>');
|
|
||||||
var_dump($matches);
|
|
||||||
print('<br><br>');
|
|
||||||
|
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return $matches;
|
return $matches;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user