Doctrine2 behavioral extensions, Translatable, Sluggable, Tree-NestedSet, Timestampable, Loggable, Sortable

Overview

Doctrine Behavioral Extensions

Build Status Latest Stable Version

This package contains extensions for Doctrine ORM and MongoDB ODM that offer new functionality or tools to use Doctrine more efficiently. These behaviors can be easily attached to the event system of Doctrine and handle the records being flushed in a behavioral way.


Doctrine Extensions 3.0 Released 🎉

3.0 focuses on refreshing this package for today's PHP. This includes:

  • Bumping minimum version requirements of PHP, Doctrine, and other dependencies
  • Implementing support for the latest Doctrine MongoDB & Common packages
  • Updating the test suite, add code and style standards, and other needed build tools
  • Cleaning up documentation, code, comments, etc.

Read the Upgrade Doc for more info.


Installation

composer require gedmo/doctrine-extensions

Upgrading

Extensions

ORM & MongoDB ODM

  • Blameable - updates string or reference fields on create, update and even property change with a string or object (e.g. user).
  • Loggable - helps tracking changes and history of objects, also supports version management.
  • Sluggable - urlizes your specified fields into single unique slug
  • Timestampable - updates date fields on create, update and even property change.
  • Translatable - gives you a very handy solution for translating records into different languages. Easy to setup, easier to use.
  • Tree - automates the tree handling process and adds some tree-specific functions on repository. (closure, nested set or materialized path) (MongoDB ODM only supports materialized path)

ORM Only

  • IpTraceable - inherited from Timestampable, sets IP address instead of timestamp
  • SoftDeleteable - allows to implicitly remove records
  • Sortable - makes any document or entity sortable
  • Uploadable - provides file upload handling in entity fields

MongoDB ODM Only

All extensions support YAML, Annotation and XML mapping. Additional mapping drivers can be easily implemented using Mapping extension to handle the additional metadata mapping.

Version Compatibility

Extensions Version Compatible Doctrine ORM & Common Library
2.4 2.5+
2.3 2.2 - 2.4

If you are setting up the Entity Manager without a framework, see the the example to prevent issues like #1310

XML Mapping

XML mapping needs to be in a different namespace, the declared namespace for Doctrine extensions is http://gediminasm.org/schemas/orm/doctrine-extensions-mapping So root node now looks like this:

<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
                 xmlns:gedmo="http://gediminasm.org/schemas/orm/doctrine-extensions-mapping">
...
</doctrine-mapping>

XML mapping xsd schemas are also versioned and can be used by version suffix:

Running Tests

To set up and run the tests, follow these steps:

  • Install Docker and ensure you have docker-compose
  • From the project root, run docker-compose up -d to start containers in daemon mode
  • Enter the container via docker-compose exec php bash and navigate to the root directory: cd /var/www
  • Install Composer dependencies via composer install
  • Run the tests: bin/phpunit -c tests/

Running the Example

To set up and run example, follow these steps:

  • go to the root directory of extensions
  • download composer: wget https://getcomposer.org/composer.phar
  • install dev libraries: php composer.phar install
  • edit example/em.php and configure your database on top of the file
  • run: ./example/bin/console or php example/bin/console for console commands
  • run: ./example/bin/console orm:schema-tool:create to create schema
  • run: php example/run.php to run example

Contributors

Thanks to everyone participating in the development of these great Doctrine extensions!

And especially ones who create and maintain new extensions:

Comments
  • Version 3 concept

    Version 3 concept

    Hello Everyone,

    Yesterday I had a couple of emails with @AkenRoberts, we talked about the future of this project.

    As you know, the package is very hard to maintain, and would desperately need refreshment.

    I'm on the side of a complete rewrite, @AkenRoberts is also leaning towards that. 1 package per component and a metapackage as the main package is also very appealing.

    I created a concept, I would like to ask your opinion about it.


    https://github.com/Padam87/sluggable2

    this repo currently contains common files, a sluggable extension, and it is just for demo / POC purposes

    I started by extending the metadata factory https://github.com/Padam87/sluggable2/blob/master/src/Metadata/ExtendedClassMetadataFactory.php

    and created an extended metadata class to hold our data https://github.com/Padam87/sluggable2/blob/master/src/Metadata/ExtendedClassMetadata.php

    extended the annotation driver to allow extensions to hook up to it https://github.com/Padam87/sluggable2/blob/master/src/Metadata/Driver/AnnotationDriver.php

    sluggable extension https://github.com/Padam87/sluggable2/blob/master/src/Metadata/Driver/SluggableDriverExtension.php

    and the listener accessing the data from the extended metadata class https://github.com/Padam87/sluggable2/blob/master/src/Listener/SluggableListener.php


    As you know, doctrine 3 is also on the way, so I had a short chat with @guilhermeblanco about the long-term viability of this concept. He said it may need some adjustments once V3 is out, but it should hold up.

    opened by Padam87 52
  • Add possibility use other hierarchical structures models (differs from NestedSet)

    Add possibility use other hierarchical structures models (differs from NestedSet)

    There are some other good models for store hierarchical structures, like closure table http://www.slideshare.net/billkarwin/sql-antipatterns-strike-back - slide 68. I think that tree-extension may support differ models.

    New Feature 
    opened by Koc 51
  • [Sluggable] Bug in slug generation ?

    [Sluggable] Bug in slug generation ?

    When using Sluggable extension, slug aren't created, i have an empty value ' '.

    phpunit result:

    macbook-julbou:tests julbou$ phpunit Gedmo/Sluggable/SluggableDocumentTest.php
    PHPUnit 3.5.13 by Sebastian Bergmann.
    
    FF
    
    Time: 1 second, Memory: 12.00Mb
    
    There were 2 failures:
    
    1) Gedmo\Sluggable\SluggableDocumentTest::testSlugGeneration
    Failed asserting that two strings are equal.
    --- Expected
    +++ Actual
    @@ @@
    -my-title-the-code
    +
    
    /Users/julbou/Sites/resowl2/src/vendor/DoctrineExtensions/tests/Gedmo/Sluggable/SluggableDocumentTest.php:72
    
    2) Gedmo\Sluggable\SluggableDocumentTest::testUniqueSlugGeneration
    Failed asserting that two strings are equal.
    --- Expected
    +++ Actual
    @@ @@
    --1
    +my-title-the-code-1
    
    /Users/julbou/Sites/resowl2/src/vendor/DoctrineExtensions/tests/Gedmo/Sluggable/SluggableDocumentTest.php:95
    
    FAILURES!
    Tests: 2, Assertions: 2, Failures: 2.
    
    
    Bug 
    opened by julesbou 39
  • Notice: Undefined index: strategy in Gedmo\Tree\TreeListener.php line 72

    Notice: Undefined index: strategy in Gedmo\Tree\TreeListener.php line 72

    Before updating gedmo tree worked like a charm! :)

    After updating the code (gedmo & other vendors) and using new annotations in entity files I got 500 Internal Server Error - ErrorException:

     Notice: Undefined index: strategy in D:\My Dropbox\Symfony\vendor\gedmo-doctrine-extensions\lib\Gedmo\Tree\TreeListener.php line 72
    

    It does not look like a bug on my side :)

    Part of the stack trace:

        in D:\My Dropbox\Symfony\app\bootstrap.php.cache at line 382    
    
        at ErrorHandler ->handle ('8', 'Undefined index: strategy', 'D:\My Dropbox\Symfony\vendor\gedmo-doctrine-extensions\lib\Gedmo\Tree\TreeListener.php', '72', array('om' => object(EntityManager), 'class' => 'Company\ProjectBundle\Entity\Category', 'config' => array('left' => 'lft', 'level' => 'lvl', 'right' => 'rgt', 'parent' => 'parent', 'useObjectClass' => 'Company\ProjectBundle\Entity\Category'), 'managerName' => 'ORM', 'this' => object(TreeListener))) 
        in D:\My Dropbox\Symfony\vendor\gedmo-doctrine-extensions\lib\Gedmo\Tree\TreeListener.php at line 72    
    
        at TreeListener ->getStrategy (object(EntityManager), 'Company\ProjectBundle\Entity\Category') 
        in D:\My Dropbox\Symfony\vendor\gedmo-doctrine-extensions\lib\Gedmo\Tree\TreeListener.php at line 197    
    
        at TreeListener ->loadClassMetadata (object(LoadClassMetadataEventArgs)) 
        in D:\My Dropbox\Symfony\vendor\doctrine-common\lib\Doctrine\Common\EventManager.php at line 64    
    
        (...)
    

    Btw. thanks for great work!

    opened by ghost 35
  • [WIP] Tree: Some missing features for Materialized path and Closure strategies + Common Repository Api

    [WIP] Tree: Some missing features for Materialized path and Closure strategies + Common Repository Api

    Hi guys,

    I've been working on this for a few days. I've added a missing functionality for the Closure strategy and Materialized Path: the buildTree method. Another missing feature for the Closure strategy I've added is the "level" property. I'm not sure if I've implemented this in the best way, so I'd like to hear comments about it.

    A last thing I want to work on is on documentation for Closure strategy. I think that after finishing all these things we'll have these two strategies a little more "robust", similar to nested set.

    Thanks.

    opened by comfortablynumb 33
  • [RFC] We should do something

    [RFC] We should do something

    Hi Everyone,

    First of all, I would like to thank @l3pp4rd for his work on this project. He has spent an amazing amount of his free time working on this, and still, to this day he contributes the most to this project.

    I think we have reached a point where this project is at a decision point. It would need a major overhaul to make it up to date again.

    I propose deprecating the library, and limiting contributions to vital fixes only.

    I would like to propose a solution too:

    • Create a new organization responsible for this project.
    • Use a modular approach, with each extension having its own repository and package.
    • Save as much of the current mapping schemas as possible, update code to PHP 7.1+, drop support for older deps.

    I think this approach would breathe new life into this project.

    • More people would be willing to contribute.
    • Extensions could be installed separately.
    • Extensions could break BC on their own, allowing a greater pace for development.

    We should also cut some extensions entirely. I propose completely dropping Uploadable (in favor of Vich), and adapting KNP's version of Translatable.

    Just as a POC I've started the work with Timestampable. The tests are running, but I have not tried it for real as of yet.

    https://github.com/doctrine-extensions

    This is of course a huge amount of work, which I cannot accomplish alone, and I think no one should do it alone. We should make sure that the project has enough contributors first. A backer company would also be nice... but I guess that is just a dream.

    So, thats about it... what do you think?

    Adam

    opened by Padam87 32
  • [Tree] `childrenHierarchy` for objects?

    [Tree] `childrenHierarchy` for objects?

    I'm looking for a way to fetch a whole mapped tree. I have found nothing in the documentation, the code or the GitHub issues. This seems to be unsupported at the moment. Basically I'm looking for a method like childrenHierarchy that returns mapped entities instead of an array.

    Could this be achieved with a custom hydrator? Has anyone tried this before?

    I'm guessing that there's some kind of limitation since this has not been implemented?

    opened by iluuu1994 31
  • Support for on-delete='CASCADE' with soft deletes

    Support for on-delete='CASCADE' with soft deletes

    When using soft deletes, and entity object is not actually being deleted, thus no cascades trigger down to associated objects.

    My original email with @l3pp4rd and @comfortablynumb:

    I'm using the soft delete feature, and its working well. In the relationship defined below, I have soft delete set up on both the Event entity (where this association is defined), as well as the associated entity, EventMetaDataValue.

    I'd like to include on-delete="CASCADE" so that the associated EventMetadataValue's deletedAt timestamp also gets updated, however this doesn't seem to trigger. Presumably this is because I'm not actually deleting the Event entity, since I'm using soft delete.

    My question is, is there a way to have that behavior take place (i.e., cascade the soft-delete down to the associated table)? Scouring the net didn't lead me to anything useful, and your docs don't reference a situation like that. I was hoping there was a syntactical way to carry out this operation, and that I won't have to write a listener to take care of it.

        <entity name="Cms\CoreBundle\Entity\Event" table="event">
             ...
            <many-to-many field="eventMetadataValues" target-entity="EventMetadataValue">
                <join-table name="event_metadata">
                    <join-columns>
                        <join-column name="event_id" referenced-column-name="id" />
                    </join-columns>
                    <inverse-join-columns>
                        <join-column name="event_metadata_value_id" referenced-column-name="id" />
                    </inverse-join-columns>
                </join-table>
            </many-to-many>
             ...
        </entity>
    

    And Gustavo's response:

    You're right, since entities which are not explicitly removed from the entity manager don't trigger any events, they are not handled by softdeleteable. One way would be to use cascade delete. But, of course, this avoids the perfomance boost of using normal db cascade delete.

    We could detect, however, an entity which is being deleted and, if it has a configuration in its join columns with cascade delete, we could softdelete its children.

    New Feature SoftDeleteable Stale 
    opened by mbadolato 30
  • Root cannot be changed manually, change parent instead

    Root cannot be changed manually, change parent instead

    This error drives me crazy! Sorry - I'm new with this.

    My composer:

    // composer.json
    {
        "minimum-stability": "dev",
        "require": {
            "php": ">=5.3.3",
            "zendframework/zendframework": "2.2.2",
            "doctrine/doctrine-orm-module": "0.8.*@dev",
            "hounddog/doctrine-data-fixture-module": "dev-master",
            "zendframework/zftool": "dev-master",
            "gedmo/doctrine-extensions": "2.3.*",
            "phploc/phploc": "*",
            "phpmd/phpmd": "dev-master",
            "sebastian/phpcpd": "2.0.*@dev",
            "pdepend/pdepend" : "dev-master",
            "ruflin/elastica": "0.20.5.*@dev",
            "zendframework/zend-developer-tools": "dev-master"
        }
    }
    

    My setup:

    zendframework/zendframework: 2.2.2
    doctrine/annotations: dev-master (316b956)
    doctrine/common: 2.4.x-dev (9a7e20e)
    doctrine/doctrine-module: 0.8.0
    doctrine/doctrine-orm-module: 0.8.0
    doctrine/orm: dev-master (927d69b)
    gedmo/doctrine-extensions: dev-master (ff48eb0)
    

    Trying to make Nested Tree by documentation tutorial.

    Error after this:

    $food= new Category;
    $food->setTitle('Food');
    $em->persist($food);
    $em->flush();
    
    Gedmo\Exception\UnexpectedValueException: Root cannot be changed manually, change parent instead in /var/www/domains/zfb2.local/data/vendor/gedmo/doctrine-extensions/lib/Gedmo/Tree/Strategy/ORM/Nested.php on line 143
    

    So I've added this for debug

    var_dump($food);
    object(Application\Entity\Category)[377]
      private 'id' => null
      private 'title' => string 'Food' (length=4)
      private 'lft' => null
      private 'lvl' => null
      private 'rgt' => null
      private 'root' => null
      private 'parent' => null
      private 'children' => null
    

    and

    // line #142 Nested.php
    var_dump($config, $changeSet);
    
    array (size=9)
      'strategy' => string 'nested' (length=6)
      'activate_locking' => boolean false
      'locking_timeout' => int 3
      'left' => string 'lft' (length=3)
      'level' => string 'lvl' (length=3)
      'right' => string 'rgt' (length=3)
      'root' => string 'root' (length=4)
      'parent' => string 'parent' (length=6)
      'useObjectClass' => string 'Application\Entity\Category' (length=27)
    
    array (size=6)
      'title' => 
        array (size=2)
          0 => null
          1 => string 'Food' (length=4)
      'lft' => 
        array (size=2)
          0 => null
          1 => int 0
      'lvl' => 
        array (size=2)
          0 => null
          1 => int 0
      'rgt' => 
        array (size=2)
          0 => null
          1 => int 0
      'root' => 
        array (size=2)
          0 => null
          1 => int 0
      'parent' => 
        array (size=2)
          0 => null
          1 => null
    

    So exception here

    # Nested.php #143
            if (isset($config['root']) && isset($changeSet[$config['root']])) {
                throw new \Gedmo\Exception\UnexpectedValueException("Root cannot be changed manually, change parent instead");
            }
    

    I can't understand how to fix this.

    Plz any help! Thx

    opened by man4red 28
  • personal translations and sluggable

    personal translations and sluggable

    Hello,

    I'm using personal translations and a sluggable field. When I insert a record I get the slug only for default locale. The slug for other locales is not created. How is it supposed to work?

    Thanks.

    Sluggable Stale 
    opened by iJanki 28
  • [WIP] Uploadable

    [WIP] Uploadable

    Look at:

    https://github.com/comfortablynumb/DoctrineExtensions/blob/uploadable/doc/uploadable.md

    Features:

    • Handling of file moving and removal automatically.
    • Setting of properties with information about mime type, size, etc.
    • Options to allow overwrite, append a number to the file name if it already exists, etc.
    • It optionally allows to give a path for each class or even individual file using a method instead of hardcoding the path in the class.
    • Not limited to file uploading. It could handle files that already exist on the server (not implemented yet)
    • Each of the upload errors has a custom exception
    • Ability to set a callback after file is moved to the configured path
    • Creating different implementations of FileInfoInterface allows to use not only uploaded files, but files from an URL, etc.
    • Possibility to generate filenames. Two generators included, and an interface to implement your own generator.
    • Size and mime type validation
    opened by comfortablynumb 28
  • Don't wrap the reader if it is already an attribute reader

    Don't wrap the reader if it is already an attribute reader

    Gedmo\Mapping\ExtensionMetadataFactory will handle pushing a reader into the mapping driver when it's working with an attribute or annotation reader. When an attribute driver is detected, it tries to provide a Gedmo\Mapping\Driver\AttributeAnnotationReader with the injected reader. However, the second argument of the Gedmo\Mapping\Driver\AttributeAnnotationReader constructor requires a Doctrine\Common\Annotations\Reader. So if the extension metadata factory is instantiated with a Gedmo\Mapping\Driver\AttributeReader passed through its constructor, things fail with a type error:

    Gedmo\Mapping\Driver\AttributeAnnotationReader::__construct(): Argument #2 ($annotationReader) must be of type Doctrine\Common\Annotations\Reader, Gedmo\Mapping\Driver\AttributeReader given, called in /app/vendor/gedmo/doctrine-extensions/src/Mapping/ExtensionMetadataFactory.php on line 208
    

    This adds a check to determine if the reader needs to be wrapped; if a Gedmo\Mapping\Driver\AttributeReader was provided, then we don't need to wrap the reader.

    opened by mbabker 2
  • [Timestampable] not-null violation on create

    [Timestampable] not-null violation on create

    Hi, We get not-null sql violation from time to time when one specific entity is created. It is happening randomly without any obvious pattern.

    Entity is table inheritance with

    #[ORM\InheritanceType(value: 'SINGLE_TABLE')]
    #[ORM\DiscriminatorColumn(name: 'discr', type: Types::STRING)]
    #[ORM\DiscriminatorMap([.....])
    
    //...
    
     #[ORM\Column(name: 'created_at', type: Types::DATETIMETZ_IMMUTABLE, nullable: false)]
        #[Gedmo\Timestampable(on: 'create')]
        private DateTimeImmutable $createdAt;
    
        #[ORM\Column(name: 'updated_at', type: Types::DATETIMETZ_IMMUTABLE, nullable: false)]
        #[Gedmo\Timestampable(on: 'update')]
        private DateTimeImmutable $updatedAt;
    

    It happen on production with following prod specific config for doctrine (i think it is default for symfony 6.x):

    when@prod:
        doctrine:
            orm:
                auto_generate_proxy_classes: false
                proxy_dir: '%kernel.build_dir%/doctrine/orm/Proxies'
                metadata_cache_driver:
                    type: pool
                    pool: cache.doctrine_metadata
                query_cache_driver:
                    type: pool
                    pool: cache.doctrine_query
                result_cache_driver:
                    type: pool
                    pool: cache.doctrine_result
    

    i recall it started after switching to php attributes with Symfony 5.3+-. Right now app is Symfony 6.2 and it continue to appear as randomly as before.

    Fix which i apply is to flush redis database holding prod caches + execute CLI commands which should do the same + restart all messenger workers so they get new cache / empty cache.

    I have no idea what is wrong or where to start debug for last 6+ months.

    Database is postgresql 14.x

    opened by drekinov 0
  • Drop support for Symfony 5.3 and older

    Drop support for Symfony 5.3 and older

    Symfony 4.4 is now only getting security fixes and 5.4 is the next LTS. This will drop support for Symfony 4.4 and 5.3 in the handful of components that are used.

    opened by mbabker 2
  • [SoftDeleteable] Deprecated `LifecycleEventArgs`

    [SoftDeleteable] Deprecated `LifecycleEventArgs`

    Hi,

    It seems doctrine/orm with version 2.14 deprecates the use of the class Doctrine\ORM\Event\LifecycleEventArgs. It will be removed in ORM 3.0. (see changelog)

    I think it will affect the SoftDeleteable behavior. Right?

    Thanks,

    Mickaël

    opened by misaert 0
  • Allow DoctrineExtensions to be configured to use attributes

    Allow DoctrineExtensions to be configured to use attributes

    Ref: #2554

    I'm not totally sure I like making the Gedmo\DoctrineExtensions class stateful, but without ballooning the class full of rather lengthy method names or some other kind of refactoring, this is probably the easiest way to start easing the hard coupling to annotations out of this class.

    This will add two state-setting methods to the Gedmo\DoctrineExtensions class:

    • withAttributes - Configures the register helpers to use an attribute reader
    • withAnnotations - Configures the register helpers to use an annotation reader

    For B/C, the class continues to use annotations by default, but calling Gedmo\DoctrineExtensions::withAttributes() will toggle everything to attributes. The withAnnotations method is kept to have a way to toggle back to annotations for whatever reason without having to resort to reflection.

    For demonstration purposes, the example app is updated to include attribute mapping as well as annotations and conditionally enables attributes when running on PHP 8. Running php example/bin/console app:print-category-translation-tree should work the same.

    opened by mbabker 1
  • [Tree] Add `@template` and `@template-extends` annotations to the Tree repositories

    [Tree] Add `@template` and `@template-extends` annotations to the Tree repositories

    I've added @template T of object and @template-extends EntityRepository<T> annotations to the Tree repositories.

    In my code I can do:

    /**
     * @template-extends \Doctrine\ORM\EntityRepository<Foo>
     */
    class FooRepository extends \Doctrine\ORM\EntityRepository
    {
    

    This is because EntityRepository has a @template annotation: https://github.com/doctrine/orm/blob/f8bf84d1aa8b67f13f9a5c1c538938eb77e66bd6/lib/Doctrine/ORM/EntityRepository.php#L36

    Now static analysis and type hints can evaluate that $fooRepository->find(123) will return a Foo object.

    But I can't do the same in my code for any repository extending a Tree repository:

    /**
     * @template-extends \Gedmo\Tree\Entity\Repository\NestedTreeRepository<Foo>
     */
    class FooRepository extends \Gedmo\Tree\Entity\Repository\NestedTreeRepository
    {
    

    These changes enable that. If you think this is a good idea, then I could also add @phpstan-return ?list<T> on children() for example to indicate that it will return an array of T.

    Tree 
    opened by 7ochem 1
Releases(v3.10.0)
  • v3.10.0(Nov 14, 2022)

    Changed

    • Bump "doctrine/event-manager" dependency from ^1.0 to ^1.2.

    Fixed

    • Tree: TreeRoot without "rootIdentifierMethod" when calling getNextSiblings() (#2518)
    • Sortable: Fix duplicated positions when manually updating position on more than one object (#2439)
    Source code(tar.gz)
    Source code(zip)
  • v3.9.0(Sep 22, 2022)

    Fixed

    • Tree: Allow sorting children by a ManyToOne relation (#2492)
    • Tree: Fix passing null to abs() function
    • Timestampable: Use an attribute in Timestampable attribute docs

    Deprecated

    • Tree: Passing null as argument 8 to Nested::shiftRangeRL()
    Source code(tar.gz)
    Source code(zip)
  • v3.8.0(Jul 17, 2022)

    Added

    • Sluggable: Add support for DateTimeImmutable fields
    • Tree: [NestedSet] childrenQueryBuilder() to allow specifying sort order separately for each field
    • Tree: [NestedSet] Added option to reorder only direct children in reorder() method

    Changed

    • Tree: In ClosureTreeRepository::removeFromTree() and NestedTreeRepository::removeFromTree() when something fails in the transaction, it uses the code from the original exception to construct the \Gedmo\Exception\RuntimeException instance instead of null.

    Fixed

    • Sluggable: Cast slug to string before passing it as argument 2 to preg_match() (#2473)
    • Sortable: [SortableGroup] Fix sorting date columns in SQLite (#2462).
    • PHPDoc of AbstractMaterializedPath::removeNode() and AbstractMaterializedPath::getChildren()
    • Retrieving the proper metadata cache from Doctrine when using a CacheWarmer.
    Source code(tar.gz)
    Source code(zip)
  • v3.7.0(May 17, 2022)

    Added

    • Add support for doctrine/persistence 3

    Changed

    • Removed call to deprecated ClassMetadataFactory::getCacheDriver() method.
    • Dropped support for doctrine/mongodb-odm < 2.3.
    • Make doctrine/cache an optional dependency.

    Fixed

    • Loggable: Fix appendNumber renaming for files without extension (#2228)
    Source code(tar.gz)
    Source code(zip)
  • v3.6.0(Mar 19, 2022)

    Added

    • Translatable: Add defaultTranslationValue option to allow null or string value (#2167). TranslatableListener can hydrate object properties with null value, but it may cause a Type error for non-nullable getter upon a missing translation.

    Fixed

    • Uploadable: FileInfoInterface::getSize() return type declaration (#2413).
    • Tree: Setting a new Tree Root when Tree Parent is null.
    • Tree: update cache key used by Closure to match Doctrine's one (#2416).
    • Tree: persist order does not affect entities on Closure (#2432)
    Source code(tar.gz)
    Source code(zip)
  • v3.5.0(Jan 10, 2022)

    Added

    • SoftDeleteable: Support to use annotations as attributes on PHP >= 8.0.
    • Blameable: Support to use annotations as attributes on PHP >= 8.0.
    • IpTraceable: Support to use annotations as attributes on PHP >= 8.0.
    • Sortable: Support to use annotations as attributes on PHP >= 8.0.
    • Sluggable: Support to use annotations as attributes on PHP >= 8.0.
    • Uploadable: Support to use annotations as attributes on PHP >= 8.0.
    • Tree: Support to use annotations as attributes on PHP >= 8.0.
    • References: Support to use annotations as attributes on PHP >= 8.0.
    • ReferenceIntegrity: Support to use annotations as attributes on PHP >= 8.0.
    • SoftDeleteable: Support for custom column types (like Carbon).
    • Timestampable: Support for custom column types (like Carbon).
    • Translatable: Added an index to Translation entity to speed up searches using Gedmo\Translatable\Entity\Repository\TranslationRepository::findTranslations() method.
    • Gedmo\Mapping\Event\AdapterInterface::getObject() method.

    Fixed

    • Blameable, IpTraceable, Timestampable: Type handling for the tracked field values configured in the origin field.
    • Loggable: Using only PHP 8 attributes.
    • References: Avoid deprecations using LazyCollection with PHP 8.1
    • Tree: Association mapping problems using Closure tree strategy (by manually defining mapping on the closure entity).
    • Wrong PHPDoc type declarations.
    • Avoid calling deprecated AbstractClassMetadataFactory::getCacheDriver() method.
    • Avoid deprecations using doctrine/mongodb-odm >= 2.2
    • Translatable: Gedmo\Translatable\Document\Repository\TranslationRepository::findObjectByTranslatedField() method accessing a non-existing key.

    Deprecated

    • Tree: When using Closure tree strategy, it is deprecated not defining the mapping associations of the closure entity.
    • Gedmo\Tool\Logging\DBAL\QueryAnalizer class without replacement.
    • Using YAML mapping is deprecated, you SHOULD migrate to attributes, annotations or XML.
    • Gedmo\Mapping\Event\AdapterInterface::__call() method.
    • Gedmo\Tool\Wrapper\AbstractWrapper::clear() method.
    • Gedmo\Tool\Wrapper\WrapperInterface::populate() method.

    Changed

    • In order to use a custom cache for storing configuration of an extension, the user has to call setCacheItemPool() on the extension listener passing an instance of Psr\Cache\CacheItemPoolInterface.
    Source code(tar.gz)
    Source code(zip)
  • v3.4.0(Dec 5, 2021)

    Added

    • PHP 8 Attributes support for Doctrine MongoDB to document & traits.
    • Support for doctrine/dbal >=3.2.
    • Timestampable: Support to use annotations as attributes on PHP >= 8.0.
    • Loggable: Support to use annotations as attributes on PHP >= 8.0.

    Changed

    • Translatable: Dropped support for other values than "true", "false", "1" and "0" in the fallback attribute of the translatable element in the XML mapping.
    • Tree: Dropped support for other values than "true", "false", "1" and "0" in the activate-locking attribute of the tree element in the XML mapping.
    • Tree: Dropped support for other values than "true", "false", "1" and "0" in the append_id, starts_with_separator and ends_with_separator attributes of the tree-path element in the XML mapping.
    • Dropped support for doctrine/dbal < 2.13.1.
    • The third argument of Gedmo\SoftDeleteable\Query\TreeWalker\Exec\MultiTableDeleteExecutor::__construct() requires a Doctrine\ORM\Mapping\ClassMetadata instance.
    Source code(tar.gz)
    Source code(zip)
  • v3.3.1(Nov 18, 2021)

    Fixed

    • Translatable: Using ORM/ODM attribute mapping and translatable annotations.
    • Tree: Missing support for tree-path-hash fields in XML mapping.
    • Tree: Check for affected rows at ClosureTreeRepository::cleanUpClosure() and Closure::updateNode().
    • Gedmo\Mapping\Driver\Xml::_loadMappingFile() behavior in scenarios where libxml_disable_entity_loader(true) was previously called.
    • Loggable: Missing support for versioned fields at attribute-override in XML mapping.
    Source code(tar.gz)
    Source code(zip)
  • v3.3.0(Nov 15, 2021)

    Added

    • Support to use Translatable annotations as attributes on PHP >= 8.0.

    Deprecated

    • Gedmo\Mapping\Driver\File::$_paths property and Gedmo\Mapping\Driver\File::setPaths() method are deprecated and will be removed in version 4.0, as they are not used.

    Fixed

    • Value passed in the --config option to fix-cs Composer script.
    • Return value for replaceRelative() and replaceInverseRelative() at Gedmo\Sluggable\Mapping\Event\Adapter\ODM if the query result does not implement Doctrine\ODM\MongoDB\Iterator\Iterator.
    • Restored compatibility with doctrine/orm >= 2.10.2 (#2272). Since doctrine/orm 2.10, Doctrine\ORM\UnitOfWork relies on SPL object IDs instead of hashes, thus we need to adapt our codebase in order to be compatible with this change. As Doctrine\ODM\MongoDB\UnitOfWork from doctrine/mongodb-odm still uses spl_object_hash(), all spl_object_hash() calls were replaced by spl_object_id() to make it work with both ORM and ODM managers.
    Source code(tar.gz)
    Source code(zip)
  • v3.2.0(Oct 5, 2021)

    Primarily marks Doctrine Extensions as conflicting with ORM 2.10 due to breaking Translations. Big thanks to @phansys for help identifying and fixing! 🙌🏼

    Added

    • PHP 8 Attributes for Doctrine ORM to entities & traits (#2251)

    Fixed

    • Removed legacy checks targeting older versions of PHP (#2201)
    • Added missing XSD definitions (#2244)
    • Replaced undefined constants from Doctrine\DBAL\Types\Type at Gedmo\Translatable\Mapping\Event\Adapter\ORM::foreignKey() (#2250)
    • Add conflict against "doctrine/orm" >=2.10 in order to guarantee the schema extension (see https://github.com/doctrine/orm/pull/8852) (#2255)
    Source code(tar.gz)
    Source code(zip)
  • v3.1.0(Jun 22, 2021)

  • v3.0.5(Apr 23, 2021)

  • v3.0.4(Mar 27, 2021)

  • v3.0.3(Jan 23, 2021)

  • v3.0.0(Sep 23, 2020)

    3.0 now available for general release. I haven't heard much feedback as far as compatibility issues or brokenness, so no time like the present to make this easier to consume and keep the library moving forward! 🥳

    [3.0.0] - 2020-09-23

    Notable & Breaking Changes

    • Minimum PHP version requirement of 7.2
    • Source files moved from /lib/Gedmo to /src
    • Added compatibility for doctrine/common 3.0 and doctrine/persistence 2.0
    • All string column type annotations changed to 191 character length (#1941)
    • Removed support for \Zend_date date format #2163
    • Renamed Zend Framework to Laminas #2163

    Changes below marked ⚠️ may also be breaking, if you have extended DoctrineExtensions.

    MongoDB

    • Requires the ext-mongodb PHP extension. Usage of ext-mongo is deprecated and will be removed in the next major version.
    • Minimum Doctrine MongoDB ODM requirement of 2.0
    • Usages of \MongoDate replaced with MongoDB\BSON\UTCDateTime

    Global / Shared

    Fixed

    • Removed null parameter from Doctrine\Common\Cache\Cache::save() calls (#1996)

    Tree

    Fixed

    • The value of path source property is cast to string type for Materialized Path Tree strategy (#2061)

    SoftDeleteable

    Changed

    • ⚠️ Generate different Date values based on column type (#2115)
    Source code(tar.gz)
    Source code(zip)
  • v3.0.0-beta2(Aug 27, 2020)

    Notable & Breaking Changes

    • Minimum PHP version requirement of 7.2
    • Source files moved from /lib/Gedmo to /src
    • Added compatibility for doctrine/common 3.0 and doctrine/persistence 2.0
    • All string column type annotations changed to 191 character length (#1941)
    • Removed support for \Zend_date date format #2163
    • Renamed Zend Framework to Laminas #2163

    Changes below marked ⚠️ may also be breaking, if you have extended DoctrineExtensions.

    MongoDB

    • Requires the ext-mongodb PHP extension. Usage of ext-mongo is deprecated and will be removed in the next major version.
    • Minimum Doctrine MongoDB ODM requirement of 2.0
    • Usages of \MongoDate replaced with MongoDB\BSON\UTCDateTime

    Global / Shared

    Fixed

    • Removed null parameter from Doctrine\Common\Cache\Cache::save() calls (#1996)

    Tree

    Fixed

    • The value of path source property is cast to string type for Materialized Path Tree strategy (#2061)

    SoftDeleteable

    Changed

    • ⚠️ Generate different Date values based on column type (#2115)
    Source code(tar.gz)
    Source code(zip)
  • v3.0.0-beta(Aug 21, 2020)

  • v2.4.42(Aug 21, 2020)

  • v2.4.41(May 10, 2020)

  • v2.4.40(Apr 28, 2020)

  • v2.4.39(Jan 18, 2020)

  • v2.4.36(Jul 26, 2018)

  • v2.4.34(Apr 17, 2018)

  • v2.4.32(Dec 28, 2017)

  • v2.4.31(Oct 12, 2017)

  • v2.4.30(Jul 2, 2017)

  • v2.4.29(May 30, 2017)

  • v2.4.28(Apr 23, 2017)

    • adds tree entity hydrator to load full object tree, suitable for nested set or other type of tree, having children and parent relations.
    • sluggable supports embedded classes.
    • loggable supports embedded classes.
    • patch nested set tree, for usage with relation as tree root.
    Source code(tar.gz)
    Source code(zip)
Owner
Doctrine Extensions
A new doctrine extension library
Doctrine Extensions
Doctrine2 behavior traits

Doctrine Behaviors This PHP library is a collection of traits and interfaces that add behaviors to Doctrine entities and repositories. It currently ha

KNP Labs 878 Dec 22, 2022
Effective tree structures in Laravel 4-5

This is a Laravel 4-8 package for working with trees in relational databases. Laravel 5.7, 5.8, 6.0, 7.0, 8.0 is supported since v5 Laravel 5.5, 5.6 i

Alexander Kalnoy 3.3k Jan 6, 2023
A simple PHP and MySQL based internet forum that displays the messages in classical threaded view (tree structure)

my little forum my little forum is a simple PHP and MySQL based internet forum that displays the messages in classical threaded view (tree structure).

Mark Hoschek 97 Dec 29, 2022
Extensions for the Eloquent ORM

Sofa/Eloquence Easy and flexible extensions for the Eloquent ORM. Currently available extensions: Searchable query - crazy-simple fulltext search thro

Jarek Tkaczyk 1.1k Dec 20, 2022
Doctrine2 behavioral extensions, Translatable, Sluggable, Tree-NestedSet, Timestampable, Loggable, Sortable

Doctrine Behavioral Extensions This package contains extensions for Doctrine ORM and MongoDB ODM that offer new functionality or tools to use Doctrine

Doctrine Extensions 3.8k Jan 5, 2023
Doctrine2 behavioral extensions

SonataDoctrineExtensions Doctrine2 behavioral extensions Branch Github Actions Code Coverage 1.x 2.x Support For general support and questions, please

Sonata Project 263 Nov 28, 2022
A Zabbix module to show groups/hosts as a tree under Monitoring -> Hosts Tree menu item

zabbix-module-hosts-tree Written according to Zabbix official documentation https://www.zabbix.com/documentation/current/manual/modules A Zabbix modul

BGmot 16 Dec 6, 2022
Doctrine2 behavior traits

Doctrine Behaviors This PHP library is a collection of traits and interfaces that add behaviors to Doctrine entities and repositories. It currently ha

KNP Labs 878 Dec 22, 2022
Sortable behaviour for Eloquent models

Sortable behaviour for Eloquent models This package provides a trait that adds sortable behaviour to an Eloquent model. The value of the order column

Spatie 1.2k Dec 22, 2022
Making Eloquent models translatable

A trait to make Eloquent models translatable This package contains a trait to make Eloquent models translatable. Translations are stored as json. Ther

Spatie 1.9k Jan 7, 2023
Extracts translatable strings from source. Identical to xgettext but for template languages.

xgettext-template Extracts translatable strings from source. Identical to xgettext(1) but for template languages. Template language support Handlebars

Guillaume C. Marty 79 Oct 7, 2022
Custom Blade components to add sortable/drag-and-drop HTML elements in your apps.

Laravel Blade Sortable Demo Repo Installation You can install the package via composer: composer require asantibanez/laravel-blade-sortable After the

Andrés Santibáñez 370 Dec 23, 2022
A lightweight domain event pattern implementation for Doctrine2.

Knp Rad Domain Event A lightweight domain event pattern implementation for Doctrine2. Official maintainers: @Einenlum Installation With composer : $ c

KNP Labs 5 Sep 23, 2022
This module integrates Silverstripe CMS with Google Translate API and then allows content editors to use automatic translation for every translatable field.

Autotranslate This module integrates Silverstripe CMS with Google Translate API and then allows content editors to use automatic translation for every

null 4 Jan 3, 2022
Experimental ActiveRecord layer on top of Doctrine2 using the Twig templating engine

This is an experiment for building ActiveRecord functionality on top of Doctrine2 using the Twig templating engine. Whether it is called Propel2 or not is irrelevant.

Francois Zaninotto 85 Dec 5, 2022
Laravel-admin grid-sortable

laravel-admin grid-sortable This extension can help you sort by dragging the rows of the data list, the front end is based on jQueryUI sortable, and t

Extensions for laravel-admin 37 Oct 14, 2022
Column sorting with Laravel 8 & 9 - Eloquent sortable

Column sorting for Laravel - Sortable - Sort by Larasort : Column sorting for Laravel - Sort easily Introduction - Larasort package This package allow

Stephen Damian - Laravel Developer 11 Sep 20, 2022
Effective tree structures in Laravel 4-5

This is a Laravel 4-8 package for working with trees in relational databases. Laravel 5.7, 5.8, 6.0, 7.0, 8.0 is supported since v5 Laravel 5.5, 5.6 i

Alexander Kalnoy 3.3k Jan 6, 2023
Libraries and scripts for crawling the TYPO3 page tree. Used for re-caching, re-indexing, publishing applications etc.

Libraries and scripts for crawling the TYPO3 page tree. Used for re-caching, re-indexing, publishing applications etc.

AOE 0 Sep 14, 2021