public function getVersions(EntityInterface $entity)
    {
        $primaryKey = (array)$this->_table->getPrimaryKey();

        $query = $this->_table->find('versions');
        $pkValue = $entity->extract($primaryKey);
        $conditions = [];
        foreach ($pkValue as $key => $value) {
            $field = current($query->aliasField($key));
            $conditions[$field] = $value;
        }
        $entities = $query->where($conditions)->all();

        if (empty($entities)) {
            return new Collection([]);
        }

        $entity = $entities->first();

        return $entity->get('_versions');
    }
public function getVersions(EntityInterface $entity)
    {
        $primaryKey = (array)$this->_table->getPrimaryKey();

        $query = $this->_table->find('versions');
        $pkValue = $entity->extract($primaryKey);
        $conditions = [];
        foreach ($pkValue as $key => $value) {
            $field = current($query->aliasField($key));
            $conditions[$field] = $value;
        }
        $entities = $query->where($conditions)->all();

        if (empty($entities)) {
            return new Collection([]);
        }

        $entity = $entities->first();

        return $entity->get('_versions');
    }
public function getVersions ( EntityInterface $ entity ) { $ primaryKey = ( array ) $ this -> _table -> getPrimaryKey ( ) ; $ query = $ this -> _table -> find ( 'versions' ) ; $ pkValue = $ entity -> extract ( $ primaryKey ) ; $ conditions = [ ] ; foreach ( $ pkValue as $ key => $ value ) { $ field = current ( $ query -> aliasField ( $ key ) ) ; $ conditions [ $ field ] = $ value ; } $ entities = $ query -> where ( $ conditions ) -> all ( ) ; if ( empty ( $ entities ) ) { return new Collection ( [ ] ) ; } $ entity = $ entities -> first ( ) ; return $ entity -> get ( '_versions' ) ; }
Returns the versions of a specific entity.

@param \Cake\Datasource\EntityInterface $entity Entity.
@return \Cake\Collection\CollectionInterface
Returns the versions of a specific entity .