http://www.doctrine-project.org/documentation/manual/1_0/ru/behaviors:core-behaviors:softdelete
You are required to enable DQL callbacks in order for all executed queries to have the dql callbacks executed on them. In the SoftDelete behavior they are used to filter the select statements to exclude all records where the deleted_at flag is set with an additional WHERE condition.
I have set a model behaviour to SoftDelete, and when I $Model->delete()
it, the actual db entry gets altered as expected.
Unfortunately, Doctrine::getTable('Model')->findAll()
still includes the record, where deleted_at
is set.
Looking through the documentation, I feel, it has to do with DQL Callbacks not being enabled in symfony. Googling didn't help.
How and where do I enable DQL callbacks in Symfony?
Thanks
Ok, I found it in old documentation for version 1.2 http://www.symfony-project.org/doctrine/1_2/en/03-Configuration
config/ProjectConfiguration.class.php
public function configureDoctrine(Doctrine_Manager $manager)
{
$manager->setAttribute(Doctrine_Core::ATTR_USE_DQL_CALLBACKS, true);
}
Don't forget to $ ./symfony cc
clear your cache.
You can also do it in the databases.yml file
all:
doctrine:
class: sfDoctrineDatabase
param:
dsn: mysql:host=localhost;dbname=database
username: user
password: password
attributes:
use_dql_callbacks: true