gedmo/doctrine-extensions
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
behat/transliterator | v1.5.0 | 143.18 kB | Artistic-1.0 | prod | 1 |
doctrine/annotations | 2.0.1 | 38.86 kB | MIT | prod | |
doctrine/collections | 2.2.2 | - | MIT | prod | |
doctrine/common | 3.4.4 | - | MIT | prod dev | |
doctrine/event-manager | 2.0.0 | 5.95 kB | MIT | prod | |
doctrine/persistence | 3.3.2 | - | MIT | prod | |
psr/cache | 3.0.0 | 6.01 kB | MIT | prod | |
symfony/cache | v7.0.7 | - | MIT | prod | |
symfony/deprecation-contracts | v3.5.0 | - | MIT | prod |
The gedmo/doctrine-extensions package is an extension set for Doctrine ORM and MongoDB ODM. This package introduces new functionalities and tools to Doctrine to optimize its use. These functionalities alter records in a behavioral way each time they are flushed. The target is to provide mechanisms in Doctrine that attach easily to the event system.
To use the gedmo/doctrine-extensions, you need to install it first via composer:
composer require gedmo/doctrine-extensions
You can use these extensions in various frameworks such as Symfony, Laravel, and Laminas.
Among the extensions are Blameable, Loggable, Sluggable, Timestampable, Translatable, Tree, IpTraceable, SoftDeleteable, Sortable, Uploadable, References(for MongoDB ODM only), and ReferenceIntegrity(for MongoDB ODM only). You can integrate these extensions using mapping methods such as Attribute, Annotation, and XML.
Here is a hypothetical code example to demonstrate the use of Timestampable (creating and updating dates):
<?php
// src/Entity/Article.php
namespace App\Entity;
use Gedmo\Mapping\Annotation as Gedmo;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\ArticleRepository")
*/
class Article
{
//...
/**
* @var \DateTime $created
*
* @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime")
*/
private $created;
/**
* @var \DateTime $updated
*
* @Gedmo\Timestampable(on="update")
* @ORM\Column(type="datetime")
*/
private $updated;
//...
}
In our example, the $created
property will get a timestamp when the article is first persisted, and $updated
will change each time the article updates.
Documentation and further details on how to use the gedmo/doctrine-extensions can be found in the package's repository on GitHub: https://github.com/doctrine-extensions/DoctrineExtensions. The documentation covers everything from installation to upgrading, usage examples, and further notes on version compatibility.