Changes between Version 2 and Version 3 of members/GRIP-UQAM/Doctrine_(PHP)


Ignore:
Timestamp:
Jan 12, 2017, 2:30:48 PM (3 years ago)
Author:
https://id.mayfirst.org/gripuqam
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • members/GRIP-UQAM/Doctrine_(PHP)

    v2 v3  
    11[[PageOutline]]
    2 == [https://packagist.org/packages/doctrine/orm doctrine/orm] ==
    3 === Doctrine Console ===
     2* [WikiPedia:Doctrine_(PHP)]
     3= [https://phppackages.org/p/doctrine/dbal doctrine/dbal] =
     4== Configuration and testing it ==
     5= [https://phppackages.org/p/doctrine/orm doctrine/orm] =
     6== Doctrine Console ==
    47* http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/tools.html
    58* https://sonata-project.org/bundles/admin/2-3/doc/getting_started/creating_an_admin.html
     
    811$ php bin/console doctrine:generate:entity --entity="AppBundle:BlogPost" --fields="title:string(255) body:text draft:boolean" --no-interaction
    912}}}
    10 === Relations ===
     13== Relations ==
    1114* //Les relations entre entités avec Doctrine2// [https://openclassrooms.com/courses/developpez-votre-site-web-avec-le-framework-symfony2/les-relations-entre-entites-avec-doctrine2 OpenClassrooms]
    1215* //Les relations entre entités dans Symfony2 avec Doctrine// [http://www.lafermeduweb.net/tutorial/les-relations-entre-entites-dans-symfony2-avec-doctrine-p97.html lafermeduweb]
    13 === Cascade ===
     16== Cascade ==
    1417* doctrine ondelete
    1518* doctrine one to many cascade
     
    1720* //Doctrine Cascade Options for OneToMany// [https://stackoverflow.com/questions/7709293/doctrine-cascade-options-for-onetomany stackoverflow]
    1821* //cascade={“remove”} VS orphanRemoval=true VS ondelete="CASCADE// [https://stackoverflow.com/questions/27472538/cascade-remove-vs-orphanremoval-true-vs-ondelete-cascade stackoverflow]
    19 === Events ===
     22== Events ==
    2023* https://openclassrooms.com/courses/developpez-votre-site-web-avec-le-framework-symfony2/les-evenements-et-extensions-doctrine
    21 === Extensions - Behaviors ===
     24== Extensions - Behaviors ==
    2225Gedmo are a standard, but Translatable is criticized
    2326* [https://packagist.org/packages/gedmo/doctrine-extensions gedmo/doctrine-extensions]
     
    2730 * //Gedmo l'extension Doctrine 2 dans Symfony2// 2012 [http://julien.edouard.overblog.com/gedmo-l-extension-doctrine-2-dans-symfony2 overblog]
    2831* [https://packagist.org/packages/knplabs/doctrine-behaviors knplabs/doctrine-behaviors]
    29 ==== Compatibility Issues between Extensions ====
     32=== Compatibility Issues between Extensions ===
    3033* SoftDeleteable - Sortable
    3134  * https://github.com/Atlantic18/DoctrineExtensions/blob/master/doc/softdeleteable.md#extra
    3235* Sluggable, Translatable and Tree
    3336  * https://github.com/Atlantic18/DoctrineExtensions/blob/master/doc/tree.md#nesting-translatable-and-sluggable-extensions
    34 ==== Audit, Revision or Loggable ====
     37=== Audit, Revision or Loggable ===
    3538* Versioning of entities and their associations [https://packagist.org/packages/simplethings/entity-audit-bundle simplethings/entity-audit-bundle]
    3639* https://sonata-project.org/bundles/doctrine-orm-admin/master/doc/reference/audit.html
     
    4043    * [https://www.youtube.com/watch?v=wxgIHNtEN84 YouTube]
    4144  * Loggable is able to track lifecycle modifications and log them using any third party log system [https://github.com/KnpLabs/DoctrineBehaviors#loggable KNP Labs]
    42 ==== Blameable ====
     45=== Blameable ===
    4346* Updates string or reference fields on create, update and even property change with a string or object (e.g. user) [https://github.com/Atlantic18/DoctrineExtensions/blob/master/doc/blameable.md Gedmo]
    4447* Track creators and updators of a given entity [https://github.com/KnpLabs/DoctrineBehaviors#blameable KNP Labs]
    45 ==== Filterable ====
     48=== Filterable ===
    4649* Simple filter result [https://github.com/KnpLabs/DoctrineBehaviors#filterable KNP Labs]
    47 ==== Geocodable ====
     50=== Geocodable ===
    4851* Extensions to PostgreSQL platform in order to work with cube and earthdistance extensions [https://github.com/KnpLabs/DoctrineBehaviors#geocodable KNP Labs]
    49 ==== IpTraceable ====
     52=== IpTraceable ===
    5053* Inherited from Timestampable, sets IP address instead of timestamp [https://github.com/Atlantic18/DoctrineExtensions/blob/master/doc/ip_traceable.md Gedmo]
    51 ==== Joinable ====
     54=== Joinable ===
    5255* KNP Labs
    53 ==== Loggable (see Audit, Revision) ====
     56=== Loggable (see Audit, Revision) ===
    5457==== References ====
    5558* Supports linking Entities in Documents and vice versa [https://github.com/Atlantic18/DoctrineExtensions/blob/master/doc/references.md Gedmo]
    56 ==== ReferenceIntegrity ====
     59=== ReferenceIntegrity ===
    5760* Constrains ODM MongoDB Document references [https://github.com/Atlantic18/DoctrineExtensions/blob/master/doc/reference_integrity.md Gedmo]
    58 ==== Revision (see Audit, Loggable) ====
    59 ==== Sluggable ====
     61=== Revision (see Audit, Loggable) ===
     62=== Sluggable ===
    6063* Urlizes your specified fields into single unique slug [https://github.com/Atlantic18/DoctrineExtensions/blob/master/doc/sluggable.md Gedmo]
    6164* Sluggable generates slugs (uniqueness is not guaranteed) for an entity [https://github.com/KnpLabs/DoctrineBehaviors#sluggable KNP Labs]
    6265* Sluggable, Translatable and Tree (Compatibility issue)
    6366  * https://github.com/Atlantic18/DoctrineExtensions/blob/master/doc/tree.md#nesting-translatable-and-sluggable-extensions
    64 ==== SoftDeleteable ====
     67=== SoftDeleteable ===
    6568* Allows to implicitly remove records [https://github.com/Atlantic18/DoctrineExtensions/blob/master/doc/softdeleteable.md Gedmo] [https://github.com/KnpLabs/DoctrineBehaviors#softDeletable KNP Labs]
    6669* SoftDeleteable - Sortable (Compatibility issue)
     
    7073* //StofDoctrineExtensionsBundle softdelete - How do I use it?// [https://stackoverflow.com/questions/16670454/stofdoctrineextensionsbundle-softdelete-how-do-i-use-it stackoverflow]
    7174* //Episode 39 - Utiliser l'extension softdeleteable avec Symfony2// DevAndClick [https://www.youtube.com/watch?v=kBzDiOFaRFY YouTube (fr)]
    72 ==== Sortable ====
     75=== Sortable ===
    7376* Makes any document or entity sortable [https://github.com/Atlantic18/DoctrineExtensions/blob/master/doc/sortable.md Gedmo] KNP Labs
    7477* SoftDeleteable - Sortable (Compatibility issue)
    7578  * https://github.com/Atlantic18/DoctrineExtensions/blob/master/doc/softdeleteable.md#extra
    76 ==== Timestampable ====
     79=== Timestampable ===
    7780* Updates date fields on create, update and even property change [https://github.com/Atlantic18/DoctrineExtensions/blob/master/doc/timestampable.md Gedmo] [https://github.com/KnpLabs/DoctrineBehaviors#timestampable KNP Labs]
    78 ==== Translatable ====
     81=== Translatable ===
    7982* Gives you a very handy solution for translating records into different languages [https://github.com/Atlantic18/DoctrineExtensions/blob/maste/doc/translatable.md Gedmo]
    8083 * [https://github.com/Atlantic18/DoctrineExtensions/blob/master/doc/translatable.md#example-code-to-use-personal-translations-with-symfony2-sonata-i18n-forms Example code to use Personal Translations with (Symfony2 Sonata) i18n Forms]
     
    8285* Sluggable, Translatable and Tree (Compatibility issue)
    8386  * https://github.com/Atlantic18/DoctrineExtensions/blob/master/doc/tree.md#nesting-translatable-and-sluggable-extensions
    84 ==== Translator ====
     87=== Translator ===
    8588* Explicit way to handle translations [https://github.com/Atlantic18/DoctrineExtensions/blob/master/doc/translatable.md Gedmo]
    86 ==== Tree ====
     89=== Tree ===
    8790* This extension automates the tree handling process and adds some tree specific functions on repository. (closure, nestedset or materialized path) [https://github.com/Atlantic18/DoctrineExtensions/blob/master/doc/tree.md Gedmo] [https://github.com/KnpLabs/DoctrineBehaviors#tree KNP Labs]
    8891* Sluggable, Translatable and Tree (Compatibility issue)
    8992  * https://github.com/Atlantic18/DoctrineExtensions/blob/master/doc/tree.md#nesting-translatable-and-sluggable-extensions
    90 ==== Uploadable ====
     93=== Uploadable ===
    9194* Provides file upload handling in entity fields [https://github.com/Atlantic18/DoctrineExtensions/blob/master/doc/uploadable.md Gedmo]
     95== Configuration and testing it ==
     96= [https://phppackages.org/p/doctrine/doctrine-bundle doctrine/doctrine-bundle]
     97== Configuration and testing it ==
     98=== Mapping Configuration ===
     99* When it appears unsure that ORM sees the mapped entities...
     100{{{#!sh
     101app$ php bin/console doctrine:mapping:info
     102}}}
     103{{{#!div class="important"
     104[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. [[span(Symfony ~3.2.1, Doctrine 2.4, style=float: right)]]
     105}}}
     106* It may be needed to set "auto_mapping" to true (in orm section of config.yml) or to configure the orm in detail.
     107* Once it is done:
     108{{{#!sh
     109app$ php bin/console doctrine:mapping:info
     110Found 1 mapped entities:
     111[OK]   AppBundle\Entity\BlogPost
     112}}}
     113=== Are the Mapped Entities in the Database Schema? ===
     114{{{#!sh
     115app$ php bin/console doctrine:schema:validate
     116[Mapping]  OK - The mapping files are correct.
     117[Database] FAIL - The database schema is not in sync with the current mapping file.
     118}}}
     119{{{#!sh
     120app$ php bin/console doctrine:schema:update --force
     121Updating database schema...
     122Database schema updated successfully! "1" queries were executed
     123}}}
     124{{{#!sh
     125app$ php bin/console doctrine:schema:validate
     126[Mapping]  OK - The mapping files are correct.
     127[Database] OK - The database schema is in sync with the mapping files.
     128}}}
     129=== Extract from command line history ===
     130==== 2017-01-11 ====
     131php u018b_EasyAdmin.php doctrine:database:create
     132composer require Sensio/Generator-Bundle
     133{{{#!sh
     134app$ php u018b_EasyAdmin.php generate:bundle --namespace=AppBundle --bundle-name=AppBundle --format=annotation --dir=../src --no-interaction
     135}}}
     136{{{#!sh
     137app$ php u018b_EasyAdmin.php doctrine:generate:entity --entity="AppBundle:BlogPost" --fields="title:string(255) body:text draft:boolean" --no-interaction
     138}}}
     139{{{#!div class="important"
     140[InvalidArgumentException] Doctrine ORM Manager named "" does not exist. [[span(Symfony ~3.2.1, style=float: right)]]
     141}}}
     142{{{#!sh
     143app$ php u018b_EasyAdmin.php cache:clear
     144}}}
     145{{{#!div class="important"
     146[Symfony\Component\Config\Definition\Exception\InvalidTypeException] The configured class "AppBundle\Entity\BlogPost" for the path "easy_admin.entities.BlogPost" is no mapped entity. [[span(Symfony ~3.2.1, style=float: right)]]
     147}}}
     148{{{#!sh
     149app$ php u018b_EasyAdmin.php doctrine:schema:validate
     150[Mapping]  OK - The mapping files are correct.
     151[Database] OK - The database schema is in sync with the mapping files.
     152}}}
     153{{{#!sh
     154app$ php u018b_EasyAdmin.php doctrine:generate:entities AppBundle/Entity/BlogPost
     155Generating entity "AppBundle\Entity\BlogPost"
     156}}}
     157{{{#!div class="important"
     158[Doctrine\ORM\Mapping\MappingException] Class "AppBundle\Entity\BlogPost" is not a valid entity or mapped super class. [[span(Symfony ~3.2.1, Doctrine 2.4, style=float: right)]]
     159}}}
     160{{{#!sh
     161app$ php u018b_EasyAdmin.php doctrine:generate:entities AppBundle/BlogPost
     162Generating entities for namespace "AppBundle\BlogPost"
     163}}}
     164{{{#!div class="important"
     165[RuntimeException] Namespace "AppBundle\BlogPost" does not contain any mapped entities. [[span(Symfony ~3.2.1, style=float: right)]]
     166}}}
     167{{{#!sh
     168app$ php u018b_EasyAdmin.php doctrine:mapping:info
     169}}}
     170{{{#!div class="important"
     171[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. [[span(Symfony ~3.2.1, Doctrine 2.4, style=float: right)]]
     172}}}
     173{{{#!sh
     174app$ php u018b_EasyAdmin.php doctrine:generate:entities AppBundle
     175Generating entities for bundle "AppBundle"
     176}}}
     177{{{#!div class="important"
     178[RuntimeException] Bundle "AppBundle" does not contain any mapped entities. [[span(Symfony ~3.2.1, style=float: right)]]
     179}}}
     180{{{#!sh
     181app$ php u018b_EasyAdmin.php doctrine:generate:entities AppBundle
     182Generating entities for bundle "AppBundle"
     183  > backing up BlogPost.php to BlogPost.php~
     184  > generating AppBundle\Entity\BlogPost
     185}}}
     186{{{#!sh
     187app$ php u018b_EasyAdmin.php doctrine:mapping:info
     188Found 1 mapped entities:
     189[OK]   AppBundle\Entity\BlogPost
     190}}}
     191{{{#!sh
     192app$ php u018b_EasyAdmin.php doctrine:schema:validate -vvv
     193[Mapping]  OK - The mapping files are correct.
     194[Database] FAIL - The database schema is not in sync with the current mapping file.
     195}}}
     196{{{#!sh
     197app$ php u018b_EasyAdmin.php doctrine:schema:update --force
     198Updating database schema...
     199Database schema updated successfully! "1" queries were executed
     200}}}
     201{{{#!sh
     202app$ php u018b_EasyAdmin.php doctrine:schema:validate -vvv
     203[Mapping]  OK - The mapping files are correct.
     204[Database] OK - The database schema is in sync with the mapping files.
     205}}}
     206{{{#!div class="important"
     207 [[span(Symfony ~3.2.1, style=float: right)]]
     208}}}
     209