From 71d3f5852dd870997597dcb471b86c54f61382f8 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Tue, 31 Jul 2012 23:25:33 +0200 Subject: [PATCH] Move Mapping Validation into Configuration section --- en/reference/association-mapping.rst | 47 --------------------------- en/reference/configuration.rst | 48 ++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 47 deletions(-) diff --git a/en/reference/association-mapping.rst b/en/reference/association-mapping.rst index d800369ea..8c20693af 100644 --- a/en/reference/association-mapping.rst +++ b/en/reference/association-mapping.rst @@ -1136,50 +1136,3 @@ been associated with an EntityManager yet: $group = $entityManager->find('Group', $groupId); $user = new User(); $user->getGroups()->add($group); - -Runtime vs Development Mapping Validation ------------------------------------------ - -For performance reasons Doctrine 2 has to skip some of the -necessary validation of association mappings. You have to execute -this validation in your development workflow to verify the -associations are correctly defined. - -You can either use the Doctrine Command Line Tool: - -.. code-block:: php - - doctrine orm:validate-schema - -Or you can trigger the validation manually: - -.. code-block:: php - - validateMapping(); - - if (count($errors) > 0) { - // Lots of errors! - echo implode("\n\n", $errors); - } - -If the mapping is invalid the errors array contains a positive -number of elements with error messages. - -.. warning:: - - One mapping option that is not validated is the use of the referenced column name. - It has to point to the equivalent primary key otherwise Doctrine will not work. - -.. note:: - - One common error is to use a backlash in front of the - fully-qualified class-name. Whenever a FQCN is represented inside a - string (such as in your mapping definitions) you have to drop the - prefix backslash. PHP does this with ``get_class()`` or Reflection - methods for backwards compatibility reasons. - - diff --git a/en/reference/configuration.rst b/en/reference/configuration.rst index cd4ea8dfc..415659733 100644 --- a/en/reference/configuration.rst +++ b/en/reference/configuration.rst @@ -581,8 +581,56 @@ In general the required code looks like this: .. code-block:: php + setCatchExceptions(true); $cli->setHelperSet($helperSet); Doctrine\ORM\Tools\Console\ConsoleRunner::addCommands($cli); $cli->run(); + +Runtime vs Development Mapping Validation +----------------------------------------- + +For performance reasons Doctrine 2 has to skip some of the +necessary validation of metadata mappings. You have to execute +this validation in your development workflow to verify the +associations are correctly defined. + +You can either use the Doctrine Command Line Tool: + +.. code-block:: php + + doctrine orm:validate-schema + +Or you can trigger the validation manually: + +.. code-block:: php + + validateMapping(); + + if (count($errors) > 0) { + // Lots of errors! + echo implode("\n\n", $errors); + } + +If the mapping is invalid the errors array contains a positive +number of elements with error messages. + +.. warning:: + + One mapping option that is not validated is the use of the referenced column name. + It has to point to the equivalent primary key otherwise Doctrine will not work. + +.. note:: + + One common error is to use a backlash in front of the + fully-qualified class-name. Whenever a FQCN is represented inside a + string (such as in your mapping definitions) you have to drop the + prefix backslash. PHP does this with ``get_class()`` or Reflection + methods for backwards compatibility reasons. + +