DoctrineExtensions

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

Github星跟蹤圖

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.

Installation

$ composer require gedmo/doctrine-extensions

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

pdo-sqlite extension is necessary.

To set up and run the tests, 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
  • run: bin/phpunit -c tests
  • optional - run mongodb service if targeting mongo 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:

概覽

名稱與所有者doctrine-extensions/DoctrineExtensions
主編程語言PHP
編程語言PHP (語言數: 3)
平台
許可證MIT License
發布數87
最新版本名稱v3.15.0 (發布於 )
第一版名稱v2.1.0 (發布於 2012-02-01 09:44:01)
創建於2010-09-03 12:08:12
推送於2024-04-08 13:43:21
最后一次提交
星數4k
關注者數84
派生數1.3k
提交數2.6k
已啟用問題?
問題數1450
打開的問題數44
拉請求數978
打開的拉請求數25
關閉的拉請求數332
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?
去到頂部