I did it on Phalcon 1.3.x but can't do on 2.0.2 branch
<?php
// model
class Directories extends Model
{
// ...
public function initialize()
{
$this->addBehavior(new SoftDelete(
[
'field' => 'active',
'value' => 0,
]
));
}
// ...
}
// and use
Directories::findFirst(1)->delete();
If I remove initialize method, mysql logs show me such queries:
389 Query DESCRIBE `directories`
389 Query SELECT `directories`.`id`, `directories`.`user_id`, `directories`.`parent_id`, `directories`.`name`, `directories`.`active` FROM `directories` WHERE `directories`.`id` = 1 LIMIT 1
389 Query DELETE FROM `directories` WHERE `id` = '1'
389 Quit
But if I return method, mysql logs show me such queries:
390 Query DESCRIBE `directories`
390 Query SELECT `directories`.`id`, `directories`.`user_id`, `directories`.`parent_id`, `directories`.`name`, `directories`.`active` FROM `directories` WHERE `directories`.`id` = 1 LIMIT 1
390 Quit
What's the problem?