public function beforeSave(Event $event, EntityInterface $entity, ArrayObject $options): void
    {
        // fallback to default icon
        if (!$entity->get('icon')) {
            $entity->set('icon', Configure::read('Icons.default'));
        }

        // fallback to hashtag as default url
        if (!$entity->get('url')) {
            $entity->set('url', '#');
        }
    }
public function beforeSave(Event $event, EntityInterface $entity, ArrayObject $options): void
    {
        // fallback to default icon
        if (!$entity->get('icon')) {
            $entity->set('icon', Configure::read('Icons.default'));
        }

        // fallback to hashtag as default url
        if (!$entity->get('url')) {
            $entity->set('url', '#');
        }
    }
public function beforeSave ( Event $ event , EntityInterface $ entity , ArrayObject $ options ) : void { // fallback to default icon if ( ! $ entity -> get ( 'icon' ) ) { $ entity -> set ( 'icon' , Configure :: read ( 'Icons.default' ) ) ; } // fallback to hashtag as default url if ( ! $ entity -> get ( 'url' ) ) { $ entity -> set ( 'url' , '#' ) ; } }
Fallback to default values for icon and url

@param \Cake\Event\Event $event Triggered event instance.
@param \Cake\Datasource\EntityInterface $entity Entity to be saved.
@param \ArrayObject $options Options passed to the save() method.
@return void
Fallback to default values for icon and url