src/Model/Table/TokensTable.php
public function beforeSave(Event $event, Entity $entity, ArrayObject $options)
    {
        if (empty($entity->expiry)) {
            $entity->expiry = Configure::read('Tokens.expiryDefaultValue');
        }

        if (!empty($entity->extra)) {
            $entity->extra = serialize($entity->extra);
        }

        //Deletes all expired tokens and tokens with the same token value
        //  and/or the same user.
        $this->deleteExpired($entity);

        return true;
    }
public function beforeSave(Event $event, Entity $entity, ArrayObject $options)
    {
        if (empty($entity->expiry)) {
            $entity->expiry = Configure::read('Tokens.expiryDefaultValue');
        }

        if (!empty($entity->extra)) {
            $entity->extra = serialize($entity->extra);
        }

        //Deletes all expired tokens and tokens with the same token value
        //  and/or the same user.
        $this->deleteExpired($entity);

        return true;
    }
public function beforeSave ( Event $ event , Entity $ entity , ArrayObject $ options ) { if ( empty ( $ entity -> expiry ) ) { $ entity -> expiry = Configure :: read ( 'Tokens.expiryDefaultValue' ) ; } if ( ! empty ( $ entity -> extra ) ) { $ entity -> extra = serialize ( $ entity -> extra ) ; } //Deletes all expired tokens and tokens with the same token value //  and/or the same user. $ this -> deleteExpired ( $ entity ) ; return true ; }
Called before each entity is saved.
Stopping this event will abort the save operation.
@param \Cake\Event\Event $event Event
@param \Cake\ORM\Entity $entity Entity
@param \ArrayObject $options Options
@return bool
@uses deleteExpired()
Called before each entity is saved . Stopping this event will abort the save operation .