protected function _fetchValues(EntityInterface $entity, array $attrNames = [])
    {
        $bundle = $this->_resolveBundle($entity);
        $conditions = [
            'EavAttribute.table_alias' => $this->_table->table(),
            'EavValues.entity_id' => $entity->get((string)$this->_table->primaryKey()),
        ];

        if ($bundle) {
            $conditions['EavAttribute.bundle'] = $bundle;
        }

        if (!empty($attrNames)) {
            $conditions['EavAttribute.name IN'] = $attrNames;
        }

        $storedValues = TableRegistry::get('Eav.EavValues')
            ->find()
            ->contain(['EavAttribute'])
            ->where($conditions)
            ->all();

        return $storedValues;
    }
protected function _fetchValues(EntityInterface $entity, array $attrNames = [])
    {
        $bundle = $this->_resolveBundle($entity);
        $conditions = [
            'EavAttribute.table_alias' => $this->_table->table(),
            'EavValues.entity_id' => $entity->get((string)$this->_table->primaryKey()),
        ];

        if ($bundle) {
            $conditions['EavAttribute.bundle'] = $bundle;
        }

        if (!empty($attrNames)) {
            $conditions['EavAttribute.name IN'] = $attrNames;
        }

        $storedValues = TableRegistry::get('Eav.EavValues')
            ->find()
            ->contain(['EavAttribute'])
            ->where($conditions)
            ->all();

        return $storedValues;
    }
protected function _fetchValues ( EntityInterface $ entity , array $ attrNames = [ ] ) { $ bundle = $ this -> _resolveBundle ( $ entity ) ; $ conditions = [ 'EavAttribute.table_alias' => $ this -> _table -> table ( ) , 'EavValues.entity_id' => $ entity -> get ( ( string ) $ this -> _table -> primaryKey ( ) ) , ] ; if ( $ bundle ) { $ conditions [ 'EavAttribute.bundle' ] = $ bundle ; } if ( ! empty ( $ attrNames ) ) { $ conditions [ 'EavAttribute.name IN' ] = $ attrNames ; } $ storedValues = TableRegistry :: get ( 'Eav.EavValues' ) -> find ( ) -> contain ( [ 'EavAttribute' ] ) -> where ( $ conditions ) -> all ( ) ; return $ storedValues ; }
Retrieves stored values for all virtual properties by name. This gets all
values at once.

This method is used to reduce the number of SQl queries, so we get all
values at once in a single Select instead of creating a select for every
field attached to the given entity.

@param \Cake\Datasource\EntityInterface $entity The entity for which get related values
@param array $attrNames List of attribute names for which get their values
@return \Cake\Datasource\ResultSetInterface
Retrieves stored values for all virtual properties by name . This gets all values at once .