public function beforeSave(Event $event, EntityInterface $entity, ArrayObject $options)
    {
        if (empty($entity->created)) {
            $entity->created = new Time;
        } elseif (!empty($entity->created) && !$entity->created instanceof Time) {
            $entity->created = new Time($entity->created);
        }
    }
public function beforeSave(Event $event, EntityInterface $entity, ArrayObject $options)
    {
        if (empty($entity->created)) {
            $entity->created = new Time;
        } elseif (!empty($entity->created) && !$entity->created instanceof Time) {
            $entity->created = new Time($entity->created);
        }
    }
public function beforeSave ( Event $ event , EntityInterface $ entity , ArrayObject $ options ) { if ( empty ( $ entity -> created ) ) { $ entity -> created = new Time ; } elseif ( ! empty ( $ entity -> created ) && ! $ entity -> created instanceof Time ) { $ entity -> created = new Time ( $ entity -> created ) ; } }
Called before each entity is saved. Stopping this event will abort the
save operation. When the event is stopped the result of the event will
be returned
@param \Cake\Event\Event $event Event object
@param \Cake\Datasource\EntityInterface $entity EntityInterface object
@param \ArrayObject $options Options
@return void
@since 2.16.1
Called before each entity is saved . Stopping this event will abort the save operation . When the event is stopped the result of the event will be returned