chg: rename findTags() to findEventIdsByTagNames()

pull/1491/head
Andreas Ziegler 2016-09-01 04:22:57 +02:00
parent 3c57dfb873
commit 542437be54
2 changed files with 5 additions and 7 deletions

View File

@ -1247,8 +1247,8 @@ class AttributesController extends AppController {
else $include[] = $tagname;
}
$this->loadModel('Tag');
if (!empty($include)) $conditions['AND'][] = array('OR' => array('Attribute.event_id' => $this->Tag->findTags($include)));
if (!empty($exclude)) $conditions['AND'][] = array('Attribute.event_id !=' => $this->Tag->findTags($exclude));
if (!empty($include)) $conditions['AND'][] = array('OR' => array('Attribute.event_id' => $this->Tag->findEventIdsByTagNames($include)));
if (!empty($exclude)) $conditions['AND'][] = array('Attribute.event_id !=' => $this->Tag->findEventIdsByTagNames($exclude));
}
if ($type != 'ALL') {
$conditions['Attribute.type ='] = $type;

View File

@ -69,17 +69,16 @@ class Tag extends AppModel {
$acceptIds = array();
$rejectIds = array();
if (!empty($accept)) {
$acceptIds = $this->findTags($accept);
$acceptIds = $this->findEventIdsByTagNames($accept);
if (empty($acceptIds)) $acceptIds[] = -1;
}
if (!empty($reject)) {
$rejectIds = $this->findTags($reject);
$rejectIds = $this->findEventIdsByTagNames($reject);
}
return array($acceptIds, $rejectIds);
}
// find all of the event Ids that belong to tags with certain names
public function findTags($array) {
public function findEventIdsByTagNames($array) {
$ids = array();
foreach ($array as $a) {
$conditions['OR'][] = array('LOWER(name) like' => strtolower($a));
@ -87,7 +86,6 @@ class Tag extends AppModel {
$params = array(
'recursive' => 1,
'contain' => 'EventTag',
//'fields' => array('id', 'name'),
'conditions' => $conditions
);
$result = $this->find('all', $params);