php - Symfony SoftDeleteable -
i have entity , use
* @gedmo\softdeleteable(fieldname="deletedat")
and when delete entity in database have entity , in field deletedat have time when delete entity , ok. need find deleteat entity? create qb
$qb = $this->getentitymanager()->createquerybuilder('d'); $qb ->select('d') ->from('artelprofilebundle:project', 'd') ->where('d.deletedat not null'); $count = $qb->getquery()->getresult(); $query = $qb->getquery(); $results = $query->getresult(); return [$results, $count];
i have 0 entity, why , how find entity ?
update in controller
class projectcontroller extends fosrestcontroller { public function getprojectsaction(paramfetcher $paramfetcher) { $manager = $this->getdoctrine()->getmanager(); if($paramfetcher->get('status')) { $manager->getfilters()->disable('soft-deleteable'); $querybuilder = $manager->getrepository('artelprofilebundle:project')->findforstatusproject($paramfetcher, $this->getuser()); }
and have error
filter 'soft-deleteable' not enabled.
my entity
/** * project * * @orm\table(name="project") * @gedmo\softdeleteable(fieldname="deletedat") * @orm\entity(repositoryclass="artel\profilebundle\entity\repository\projectrepository") * @exclusionpolicy("all") */ class project { ///// /** * @var \datetime $deletedat * * @orm\column(name="deleted_at", type="datetime", nullable=true) * @type("datetime") * @expose() */ protected $deletedat;
help please
solved mismatch between name use in config , in code
filters: softdeleteable: class: gedmo\softdeleteable\filter\softdeleteablefilter enabled: true stof_doctrine_extensions: default_locale: "%locale%" orm: default: timestampable: true sluggable: true softdeleteable: true
and in action
$manager->getfilters()->disable('softdeleteable');
and have entity deleted
Comments
Post a Comment