/** * @param $elementUid * @param $table * @param $field * * @return array|NULL */ public function findCategoriesForElement($elementUid, $table, $field) { $fields = $this->getTable() . '.*'; $mm = 'sys_category_record_mm'; $tablePart = $this->getTable() . ' INNER JOIN ' . $mm . ' ON ' . $mm . '.fieldname=' . $this->getDb()->fullQuoteStr($field, '') . ' AND ' . $mm . '.tablenames=' . $this->getDb()->fullQuoteStr($table, '') . ' AND ' . $mm . '.uid_local=' . $this->getTable() . '.uid AND ' . $mm . '.uid_foreign=' . intval($elementUid); $where = '1=1' . DatabaseFactory::enableFields($this->getTable()); return $this->getDb()->exec_SELECTgetRows($fields, $tablePart, $where); }
/** * @param $uidList * * @return array|NULL */ public function findByUidList($uidList) { $list = implode(',', GeneralUtility::intExplode(',', $uidList, 1)); if ($list != '') { return $this->getDb()->exec_SELECTgetRows('*', $this->getTable(), 'uid IN (' . $list . ')' . DatabaseFactory::enableFields($this->getTable()), '', 'FIELD(uid, ' . $list . ')'); } else { throw new \Exception('Given uid list does not contain uids! Table: ' . $this->getTable()); } }
/** * @param $uidList * * @return array|NULL * @throws \Exception */ public function findByUidList($uidList) { $list = implode(',', GeneralUtility::intExplode(',', $uidList, 1)); if ($list != '') { return $this->getDb()->exec_SELECTgetRows('*', $this->getTable(), 'uid IN (' . $list . ')' . DatabaseFactory::enableFields($this->getTable()), '', 'FIELD(uid, ' . $list . ')'); } else { return array(); } }
/** * @param $fieldName * @param $value * * @return array */ public function findByIdentifier($fieldName, $value) { if ($this->checkFieldName($fieldName)) { $rows = $this->getDb()->exec_SELECTgetRows('*', $this->table, $fieldName . '=' . $this->getDb()->fullQuoteStr($value, $this->table) . DatabaseFactory::enableFields($this->table)); if ($rows == NULL) { $rows = array(); } } else { throw new Exception('Invalid fieldname "' . htmlspecialchars($fieldName) . '" detected!'); } return $rows; }
/** * @param $speakerUid * * @return array */ public function findCoursesOfSpeaker($speakerUid) { $result = array(); if ($speakerUid > 0) { $fields = '*'; $table = $this->getTable(); $where = 'FIND_IN_SET(' . (int) $speakerUid . ', speaker)' . DatabaseFactory::enableFields($this->getTable()); $rows = $this->getDb()->exec_SELECTgetRows($fields, $table, $where); if (is_array($rows)) { $result = $rows; } } return $result; }
/** * Return all active items * * @return array|NULL */ public function findAll() { return $this->getDb()->exec_SELECTgetRows('*', $this->getTable(), '1=1' . DatabaseFactory::enableFields($this->getTable())); }