We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

how to setup SoftDelete behavior across project

namespace PhalconRest\Models;
use Phalcon\Mvc\Model\Behavior\SoftDelete;
use Phalcon\Mvc\Collection as Collection;

class ModelBase extends Collection {

 public function initialize() {

    $softDelete = new SoftDelete([
                'field' => 'is_deleted',
                'value' => 1



Can you please suggest me how do I fix the below error.

PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Phalcon\\Mvc\\Collection::addBehavior() must implement interface Phalcon\\Mvc\\Collection\\BehaviorInterface, instance of Phalcon\\Mvc\\Model\\Behavior\\SoftDelete given 


edited Jan '19

We have this defined in AbstractModel as follows:

 * Initialize method for AbsractModel
public function initializeAbstractModel() {
    $this->addBehavior(new SoftDelete(
            'field' => 'activated',
            'value' => 0