public function attributes($bundle = null)
    {
        $key = empty($bundle) ? '@all' : $bundle;
        if (isset($this->_attributes[$key])) {
            return $this->_attributes[$key];
        }

        $this->_attributes[$key] = [];
        $cacheKey = $this->_table->table() . '_' . $key;
        $attrs = Cache::read($cacheKey, 'eav_table_attrs');

        if (empty($attrs)) {
            $conditions = ['EavAttributes.table_alias' => $this->_table->table()];
            if (!empty($bundle)) {
                $conditions['EavAttributes.bundle'] = $bundle;
            }

            $attrs = TableRegistry::get('Eav.EavAttributes')
                ->find()
                ->where($conditions)
                ->all()
                ->toArray();

            Cache::write($cacheKey, $attrs, 'eav_table_attrs');
        }

        foreach ($attrs as $attr) {
            $this->_attributes[$key][$attr->get('name')] = $attr;
        }

        return $this->attributes($bundle);
    }
public function attributes($bundle = null)
    {
        $key = empty($bundle) ? '@all' : $bundle;
        if (isset($this->_attributes[$key])) {
            return $this->_attributes[$key];
        }

        $this->_attributes[$key] = [];
        $cacheKey = $this->_table->table() . '_' . $key;
        $attrs = Cache::read($cacheKey, 'eav_table_attrs');

        if (empty($attrs)) {
            $conditions = ['EavAttributes.table_alias' => $this->_table->table()];
            if (!empty($bundle)) {
                $conditions['EavAttributes.bundle'] = $bundle;
            }

            $attrs = TableRegistry::get('Eav.EavAttributes')
                ->find()
                ->where($conditions)
                ->all()
                ->toArray();

            Cache::write($cacheKey, $attrs, 'eav_table_attrs');
        }

        foreach ($attrs as $attr) {
            $this->_attributes[$key][$attr->get('name')] = $attr;
        }

        return $this->attributes($bundle);
    }
public function attributes ( $ bundle = null ) { $ key = empty ( $ bundle ) ? '@all' : $ bundle ; if ( isset ( $ this -> _attributes [ $ key ] ) ) { return $ this -> _attributes [ $ key ] ; } $ this -> _attributes [ $ key ] = [ ] ; $ cacheKey = $ this -> _table -> table ( ) . '_' . $ key ; $ attrs = Cache :: read ( $ cacheKey , 'eav_table_attrs' ) ; if ( empty ( $ attrs ) ) { $ conditions = [ 'EavAttributes.table_alias' => $ this -> _table -> table ( ) ] ; if ( ! empty ( $ bundle ) ) { $ conditions [ 'EavAttributes.bundle' ] = $ bundle ; } $ attrs = TableRegistry :: get ( 'Eav.EavAttributes' ) -> find ( ) -> where ( $ conditions ) -> all ( ) -> toArray ( ) ; Cache :: write ( $ cacheKey , $ attrs , 'eav_table_attrs' ) ; } foreach ( $ attrs as $ attr ) { $ this -> _attributes [ $ key ] [ $ attr -> get ( 'name' ) ] = $ attr ; } return $ this -> attributes ( $ bundle ) ; }
Gets all attributes added to this table.

@param string|null $bundle Get attributes within given bundle, or all of them
regardless of the bundle if not provided
@return array List of attributes indexed by name (virtual column name)
Gets all attributes added to this table .