src/Db/Orm/BaseActiveRecord.php
public function beforeDelete()
    {
        $isValid = true;
        $this->emit(self::EVENT_BEFORE_DELETE, [&$this, &$isValid]);

        return $isValid;
    }
public function beforeDelete()
    {
        $isValid = true;
        $this->emit(self::EVENT_BEFORE_DELETE, [&$this, &$isValid]);

        return $isValid;
    }
This method is invoked before deleting a record.

The default implementation raises the [[EVENT_BEFORE_DELETE]] event.
When overriding this method, make sure you call the parent implementation like the following:

```php
public function beforeDelete()
{
if (!parent::beforeDelete()) {
return false;
}

// ...custom code here...
return true;
}
```

@return bool whether the record should be deleted. Defaults to `true`.