/** * Gets all parent references. * * @return array|ReferenceEntity[] */ public function getParents() { if (!isset($this->parents)) { $this->parents = []; $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_refindex'); $result = $queryBuilder->select('*')->from('sys_refindex')->where($queryBuilder->expr()->eq('deleted', $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT)), $queryBuilder->expr()->eq('ref_table', $queryBuilder->createNamedParameter($this->table, \PDO::PARAM_STR)), $queryBuilder->expr()->eq('ref_uid', $queryBuilder->createNamedParameter($this->id, \PDO::PARAM_INT)), $queryBuilder->expr()->eq('workspace', $queryBuilder->createNamedParameter($this->dependency->getWorkspace(), \PDO::PARAM_INT)))->orderBy('sorting')->execute(); while ($row = $result->fetch()) { $arguments = ['table' => $row['tablename'], 'id' => $row['recuid'], 'field' => $row['field'], 'scope' => self::REFERENCES_ParentOf]; $callbackResponse = $this->dependency->executeEventCallback(self::EVENT_CreateParentReference, $this, $arguments); if ($callbackResponse !== self::RESPONSE_Skip) { $this->parents[] = $this->getDependency()->getFactory()->getReferencedElement($row['tablename'], $row['recuid'], $row['field'], [], $this->getDependency()); } } } return $this->parents; }
/** * Gets all parent references. * * @return array|ReferenceEntity[] */ public function getParents() { if (!isset($this->parents)) { $this->parents = array(); $where = 'ref_table=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->table, 'sys_refindex') . ' AND deleted=0 AND ref_uid=' . $this->id . ' AND workspace=' . $this->dependency->getWorkspace(); $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'sys_refindex', $where, '', 'sorting'); if (is_array($rows)) { foreach ($rows as $row) { $arguments = array('table' => $row['tablename'], 'id' => $row['recuid'], 'field' => $row['field'], 'scope' => self::REFERENCES_ParentOf); $callbackResponse = $this->dependency->executeEventCallback(self::EVENT_CreateParentReference, $this, $arguments); if ($callbackResponse !== self::RESPONSE_Skip) { $this->parents[] = $this->getDependency()->getFactory()->getReferencedElement($row['tablename'], $row['recuid'], $row['field'], array(), $this->getDependency()); } } } } return $this->parents; }