-
-
Notifications
You must be signed in to change notification settings - Fork 130
Misc development stuff
Vladimir edited this page Aug 27, 2024
·
5 revisions
In the application directory
php bin/console nucleos:user:create [username]
php bin/console nucleos:user:activate [username]
php bin/console nucleos:user:promote [username] [role]
Soft deletion is not enabled by default, so you will have to filter out manually records, check the end of this list
- In the Entity.orm.xml, add in
doctrine-mapping
propertyxmlns:gedmo="http://gediminasm.org/schemas/orm/doctrine-extensions-mapping"
- In the Entity.orm.xml add
<field name="deletedAt" type="datetime" column="deleted_at" nullable="true"/>
<gedmo:soft-deleteable field-name="deletedAt" time-aware="false" hard-delete="false" />
- In the Entity.php file add
use Gedmo\SoftDeleteable\Traits\SoftDeleteable;
use SoftDeleteable;
- Edit
src/Doctrine/EventSubscriber/PostSoftDeleteSubscriber.php
if you want to implement some behaviour on soft deletion - If you want to filter out soft deleted in a specific endpoint, add the name of the route here :
src/Api/EventSubscriber/SoftDeletedSubscriber.php
- If you want to filter out soft deleted object in a specific part of code
$this->getDoctrine()->getManager()->getFilters()->enable('soft_deleteable');
// some queries you want to filter out here
$stores = $this->getDoctrine()->getRepository(Store::class)->findBy([], ['name' => 'ASC']);
$this->getDoctrine()->getManager()->getFilters()->disable('soft_deleteable');