public function getParent($id)
    {
        /** @var Statement $statement */
        $dataItem     = $this->get($id);
        $queryBuilder = $this->driver->getSelectQueryBuilder();
        $queryBuilder->andWhere($this->driver->getUniqueId() . " = " . $dataItem->getAttribute($this->getParentField()));
        $statement  = $queryBuilder->execute();
        $rows       = array($statement->fetch());
        $hasResults = count($rows) > 0;
        $parent     = null;

        if ($hasResults) {
            $this->driver->prepareResults($rows);
            $parent = $rows[0];
        }

        return $parent;
    }
public function getParent($id)
    {
        /** @var Statement $statement */
        $dataItem     = $this->get($id);
        $queryBuilder = $this->driver->getSelectQueryBuilder();
        $queryBuilder->andWhere($this->driver->getUniqueId() . " = " . $dataItem->getAttribute($this->getParentField()));
        $statement  = $queryBuilder->execute();
        $rows       = array($statement->fetch());
        $hasResults = count($rows) > 0;
        $parent     = null;

        if ($hasResults) {
            $this->driver->prepareResults($rows);
            $parent = $rows[0];
        }

        return $parent;
    }
public function getParent ( $ id ) { /** @var Statement $statement */ $ dataItem = $ this -> get ( $ id ) ; $ queryBuilder = $ this -> driver -> getSelectQueryBuilder ( ) ; $ queryBuilder -> andWhere ( $ this -> driver -> getUniqueId ( ) . " = " . $ dataItem -> getAttribute ( $ this -> getParentField ( ) ) ) ; $ statement = $ queryBuilder -> execute ( ) ; $ rows = array ( $ statement -> fetch ( ) ) ; $ hasResults = count ( $ rows ) > 0 ; $ parent = null ; if ( $ hasResults ) { $ this -> driver -> prepareResults ( $ rows ) ; $ parent = $ rows [ 0 ] ; } return $ parent ; }
Get parent by child ID

@param $id
@return DataItem|null
Get parent by child ID