public function afterSave(Event $event, EntityInterface $entity, ArrayObject $options)
    {
        if (!$this->config('status')) {
            return true;
        }

        // as we don't know entity's ID on beforeSave, we must delay values storage;
        // all this occurs inside a transaction so we are safe
        if (!empty($this->_cache['createValues'])) {
            foreach ($this->_cache['createValues'] as $valueEntity) {
                $valueEntity->set('entity_id', $this->_toolbox->getEntityId($entity));
                $valueEntity->unsetProperty('id');
                TableRegistry::get('Eav.EavValues')->save($valueEntity);
            }
            $this->_cache['createValues'] = [];
        }

        foreach ($this->_attributesForEntity($entity) as $attr) {
            $field = $this->_prepareMockField($entity, $attr);
            $field->afterSave();
        }

        if ($this->config('cacheMap')) {
            $this->updateEavCache($entity);
        }

        return true;
    }
public function afterSave(Event $event, EntityInterface $entity, ArrayObject $options)
    {
        if (!$this->config('status')) {
            return true;
        }

        // as we don't know entity's ID on beforeSave, we must delay values storage;
        // all this occurs inside a transaction so we are safe
        if (!empty($this->_cache['createValues'])) {
            foreach ($this->_cache['createValues'] as $valueEntity) {
                $valueEntity->set('entity_id', $this->_toolbox->getEntityId($entity));
                $valueEntity->unsetProperty('id');
                TableRegistry::get('Eav.EavValues')->save($valueEntity);
            }
            $this->_cache['createValues'] = [];
        }

        foreach ($this->_attributesForEntity($entity) as $attr) {
            $field = $this->_prepareMockField($entity, $attr);
            $field->afterSave();
        }

        if ($this->config('cacheMap')) {
            $this->updateEavCache($entity);
        }

        return true;
    }
public function afterSave ( Event $ event , EntityInterface $ entity , ArrayObject $ options ) { if ( ! $ this -> config ( 'status' ) ) { return true ; } // as we don't know entity's ID on beforeSave, we must delay values storage; // all this occurs inside a transaction so we are safe if ( ! empty ( $ this -> _cache [ 'createValues' ] ) ) { foreach ( $ this -> _cache [ 'createValues' ] as $ valueEntity ) { $ valueEntity -> set ( 'entity_id' , $ this -> _toolbox -> getEntityId ( $ entity ) ) ; $ valueEntity -> unsetProperty ( 'id' ) ; TableRegistry :: get ( 'Eav.EavValues' ) -> save ( $ valueEntity ) ; } $ this -> _cache [ 'createValues' ] = [ ] ; } foreach ( $ this -> _attributesForEntity ( $ entity ) as $ attr ) { $ field = $ this -> _prepareMockField ( $ entity , $ attr ) ; $ field -> afterSave ( ) ; } if ( $ this -> config ( 'cacheMap' ) ) { $ this -> updateEavCache ( $ entity ) ; } return true ; }
After an entity is saved.

@param \Cake\Event\Event $event The event that was triggered
@param \Cake\Datasource\EntityInterface $entity The entity that was saved
@param \ArrayObject $options Additional options given as an array
@return bool True always
After an entity is saved .