Code Monkey home page Code Monkey logo

doctrineextensions's Introduction

Doctrine Behavioral Extensions

Continuous Integration Quality Assurance Coding Standards 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 Attribute, 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 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 (you are now in the root directory: /var/www)
  • Install Composer dependencies via composer install
  • Run the tests: vendor/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
  • install dev libraries: composer install
  • edit example/em.php and configure your database on top of the file
  • run: php example/bin/console or php example/bin/console for console commands
  • run: php example/bin/console orm:schema-tool:create to create the schema
  • run: php example/bin/console app:print-category-translation-tree to run the example to print the category translation tree

Contributors

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

And especially ones who create and maintain new extensions:

doctrineextensions's People

Contributors

l3pp4rd avatar franmomu avatar phansys avatar akenroberts avatar comfortablynumb avatar stof avatar cevou avatar ejsidisi avatar mbabker avatar lbotsch avatar alsatian67 avatar slamdunk avatar dbu avatar mitrae avatar everzet avatar wesleyvanopdorp avatar mnapoli avatar birko avatar alterphp avatar stephanvierkant avatar delboy1978uk avatar khepin avatar iluuu1994 avatar vstelmakh avatar vetalt avatar julesbou avatar dantudor avatar djlambert avatar tiger-seo avatar chris53897 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.