- doctrine/dbal
-
doctrine/orm
- Doctrine Console
- Relations
- Cascade
- Events
- Extensions - Behaviors
- Configuration and testing it
- [https://phppackages.org/p/doctrine/doctrine-bundle …
doctrine/dbal
Configuration and testing it
doctrine/orm
Doctrine Console
- http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/tools.html
- https://sonata-project.org/bundles/admin/2-3/doc/getting_started/creating_an_admin.html
$ php bin/console doctrine:generate:entity --entity="AppBundle:Category" --fields="name:string(255)" --no-interaction $ php bin/console doctrine:generate:entity --entity="AppBundle:BlogPost" --fields="title:string(255) body:text draft:boolean" --no-interaction
Relations
- Les relations entre entités avec Doctrine2 OpenClassrooms
- Les relations entre entités dans Symfony2 avec Doctrine lafermeduweb
Cascade
- doctrine ondelete
- doctrine one to many cascade
- 8. Working with Associations readthedocs
- Doctrine Cascade Options for OneToMany// stackoverflow
- cascade={“remove”} VS orphanRemoval=true VS ondelete="CASCADE stackoverflow
Events
Extensions - Behaviors
Gedmo are a standard, but Translatable is criticized
- gedmo/doctrine-extensions
- https://github.com/Atlantic18/DoctrineExtensions#extensions-and-documentation
- https://github.com/Atlantic18/DoctrineExtensions/tree/master/doc
- https://atlantic18.github.io/DoctrineExtensions/
- Gedmo l'extension Doctrine 2 dans Symfony2 2012 overblog
- knplabs/doctrine-behaviors
Compatibility Issues between Extensions
- SoftDeleteable - Sortable
- Sluggable, Translatable and Tree
Audit, Revision or Loggable
- Versioning of entities and their associations simplethings/entity-audit-bundle
- https://sonata-project.org/bundles/doctrine-orm-admin/master/doc/reference/audit.html
- Loggable
- Helps tracking changes and history of objects, also supports version management Gedmo
- Admin support picoss/sonata-extra-admin-bundle doc/audit_manager
- YouTube
- Loggable is able to track lifecycle modifications and log them using any third party log system KNP Labs
- Helps tracking changes and history of objects, also supports version management Gedmo
Blameable
- Updates string or reference fields on create, update and even property change with a string or object (e.g. user) Gedmo
- Track creators and updators of a given entity KNP Labs
Filterable
- Simple filter result KNP Labs
Geocodable
- Extensions to PostgreSQL platform in order to work with cube and earthdistance extensions KNP Labs
IpTraceable
- Inherited from Timestampable, sets IP address instead of timestamp Gedmo
Joinable
- KNP Labs
Loggable (see Audit, Revision)
References
- Supports linking Entities in Documents and vice versa Gedmo
ReferenceIntegrity
- Constrains ODM MongoDB Document references Gedmo
Revision (see Audit, Loggable)
Sluggable
- Urlizes your specified fields into single unique slug Gedmo
- Sluggable generates slugs (uniqueness is not guaranteed) for an entity KNP Labs
- Sluggable, Translatable and Tree (Compatibility issue)
SoftDeleteable
- Allows to implicitly remove records Gedmo KNP Labs
- SoftDeleteable - Sortable (Compatibility issue)
- Admin support picoss/sonata-extra-admin-bundle
- keyword: SoftDeleteable
- StofDoctrineExtensionsBundle softdelete - How do I use it? stackoverflow
- Episode 39 - Utiliser l'extension softdeleteable avec Symfony2 DevAndClick YouTube (fr)
Sortable
- Makes any document or entity sortable Gedmo KNP Labs
- SoftDeleteable - Sortable (Compatibility issue)
Timestampable
Translatable
- Gives you a very handy solution for translating records into different languages Gedmo
- KNP Labs
- Sluggable, Translatable and Tree (Compatibility issue)
Translator
- Explicit way to handle translations Gedmo
Tree
- This extension automates the tree handling process and adds some tree specific functions on repository. (closure, nestedset or materialized path) Gedmo KNP Labs
- Sluggable, Translatable and Tree (Compatibility issue)
Uploadable
- Provides file upload handling in entity fields Gedmo
Configuration and testing it
doctrine/doctrine-bundle
Configuration and testing it
Mapping Configuration
- When it appears unsure that ORM sees the mapped entities...
app$ php bin/console doctrine:mapping:info
[Exception] You do not have any mapped Doctrine ORM entities according to the current configuration. If you have entities or mapping files you should check your mapping configuration for errors. Symfony ~3.2.1, Doctrine 2.4
- It may be needed to set "auto_mapping" to true (in orm section of config.yml) or to configure the orm in detail.
- Once it is done:
app$ php bin/console doctrine:mapping:info Found 1 mapped entities: [OK] AppBundle\Entity\BlogPost
Are the Mapped Entities in the Database Schema?
app$ php bin/console doctrine:schema:validate [Mapping] OK - The mapping files are correct. [Database] FAIL - The database schema is not in sync with the current mapping file.
app$ php bin/console doctrine:schema:update --force Updating database schema... Database schema updated successfully! "1" queries were executed
app$ php bin/console doctrine:schema:validate [Mapping] OK - The mapping files are correct. [Database] OK - The database schema is in sync with the mapping files.
Extract from command line history
2017-01-11
php u018b_EasyAdmin.php doctrine:database:create composer require Sensio/Generator-Bundle
app$ php u018b_EasyAdmin.php generate:bundle --namespace=AppBundle --bundle-name=AppBundle --format=annotation --dir=../src --no-interaction
app$ php u018b_EasyAdmin.php doctrine:generate:entity --entity="AppBundle:BlogPost" --fields="title:string(255) body:text draft:boolean" --no-interaction
[InvalidArgumentException] Doctrine ORM Manager named "" does not exist. Symfony ~3.2.1
app$ php u018b_EasyAdmin.php cache:clear
[Symfony\Component\Config\Definition\Exception\InvalidTypeException] The configured class "AppBundle\Entity\BlogPost" for the path "easy_admin.entities.BlogPost" is no mapped entity. Symfony ~3.2.1
app$ php u018b_EasyAdmin.php doctrine:schema:validate [Mapping] OK - The mapping files are correct. [Database] OK - The database schema is in sync with the mapping files.
app$ php u018b_EasyAdmin.php doctrine:generate:entities AppBundle/Entity/BlogPost Generating entity "AppBundle\Entity\BlogPost"
[Doctrine\ORM\Mapping\MappingException] Class "AppBundle\Entity\BlogPost" is not a valid entity or mapped super class. Symfony ~3.2.1, Doctrine 2.4
app$ php u018b_EasyAdmin.php doctrine:generate:entities AppBundle/BlogPost Generating entities for namespace "AppBundle\BlogPost"
[RuntimeException] Namespace "AppBundle\BlogPost" does not contain any mapped entities. Symfony ~3.2.1
app$ php u018b_EasyAdmin.php doctrine:mapping:info
[Exception] You do not have any mapped Doctrine ORM entities according to the current configuration. If you have entities or mapping files you should check your mapping configuration for errors. Symfony ~3.2.1, Doctrine 2.4
app$ php u018b_EasyAdmin.php doctrine:generate:entities AppBundle Generating entities for bundle "AppBundle"
[RuntimeException] Bundle "AppBundle" does not contain any mapped entities. Symfony ~3.2.1
app$ php u018b_EasyAdmin.php doctrine:generate:entities AppBundle Generating entities for bundle "AppBundle" > backing up BlogPost.php to BlogPost.php~ > generating AppBundle\Entity\BlogPost
app$ php u018b_EasyAdmin.php doctrine:mapping:info Found 1 mapped entities: [OK] AppBundle\Entity\BlogPost
app$ php u018b_EasyAdmin.php doctrine:schema:validate -vvv [Mapping] OK - The mapping files are correct. [Database] FAIL - The database schema is not in sync with the current mapping file.
app$ php u018b_EasyAdmin.php doctrine:schema:update --force Updating database schema... Database schema updated successfully! "1" queries were executed
app$ php u018b_EasyAdmin.php doctrine:schema:validate -vvv [Mapping] OK - The mapping files are correct. [Database] OK - The database schema is in sync with the mapping files.
Symfony ~3.2.1