l0wskilled/api-platform-traits
API Platform Traits offers reusable ORM and ODM traits for identifiers, timestamps, and soft deletes, with setup guidance for Gedmo/Stof Doctrine extensions to simplify common entity properties in API Platform projects.
Package to ease the use of common properties needed for the api platform package.
You may want to have a look at: https://github.com/epubli/api-platform-test
Add the stof doctrine extension:
composer require stof/doctrine-extensions-bundle
Edit the config file config/packages/stof_doctrine_extensions.yaml
It should look like this:
stof_doctrine_extensions:
default_locale: en_US
orm:
default:
softdeleteable: true
timestampable: true
Here is an example class which implements these traits:
use Epubli\ApiPlatform\TraitBundle\OrmSoftDeletableTrait;
use Epubli\ApiPlatform\TraitBundle\OrmTimestampableTrait;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=false)
*/
class Example
{
use OrmTimestampableTrait;
use OrmSoftDeletableTrait;
}
How can I help you explore Laravel packages today?