Skip to content

Instantly share code, notes, and snippets.

@doctrinebot
Created December 13, 2015 18:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doctrinebot/6994899ecf18cf5f368f to your computer and use it in GitHub Desktop.
Save doctrinebot/6994899ecf18cf5f368f to your computer and use it in GitHub Desktop.
Attachments to Doctrine Jira Issue DDC-372 - https://github.com/doctrine/doctrine2/issues/4556
Index: manual/en/tools.txt
===================================================================
--- manual/en/tools.txt (revision 7213)
+++ manual/en/tools.txt (working copy)
@@ -6,7 +6,8 @@
If you installed Doctrine 2 through PEAR, the `doctrine` command line tool should already be available to you.
-If you use Doctrine through SVN or a release package you need to copy the `doctrine` and `doctrine.php` files from the `tools/sandbox` or `bin` folder, respectively, to a location of your choice, for example a `tools` folder of your project. In addition you may need to edit `doctrine.php` and adjust some paths to the new environment.
+If you use Doctrine through SVN or a release package you need to copy the `doctrine` and `doctrine.php` files from the `tools/sandbox` or `bin` folder, respectively, to a location of your choice, for example a `tools` folder of your project.
+In addition you may need to edit `doctrine.php` and adjust some paths to the new environment. You may want to add require_once() statement at the top of doctrine.php to set up the include_path for Doctrine classes.
+++ Getting Help
@@ -39,11 +40,18 @@
'path' => 'database.sqlite'
);
- $em = \Doctrine\ORM\EntityManager::create($connectionOptions, $config);
+ $em = \Doctrine\ORM\EntityManager::create($connectionOptions, $ormConfig);
$cliConfig = new \Doctrine\Common\Cli\Configuration();
$cliConfig->setAttribute('em', $em);
+ $cliConfig->setAttribute('globalOptions', array(
+ 'class-dir' => '/path/to/myproject/lib/MyProject/Models/'
+ ));
+It is important to define an instance of Doctrine\Common\Cli\Configuration that the doctrine.php script will ultimately use. For the required name of this variable, check the doctrine.php included in your package; the most new ones will automatically find the variable no matter what its name is, as long as it is an instance of the right class.
+The cli configuration should contain at least the 'em' attribute, set to the EntityManager. To use many tasks a 'globalOptions' array should be set.
+The globalOptions content will be passed to every command line task. For instance, to use the orm:schema-tool task to generate database tables from annotations, the class-dir global option must be set as in the example.
+
+++ Task Overview
The following tasks are currently available:
@@ -76,7 +84,7 @@
$tool->dropSchema($classes);
This drops all the tables that are currently used by your metadata model.
-When you are changing your metadata alot durving development you might want
+When you are changing your metadata alot during development you might want
to drop the complete database instead of only the tables of the current model
to clean up with orphaned tables.
@@ -114,6 +122,8 @@
$ php doctrine orm:schema-tool --create --dump-sql
+Before using the orm:schema-tool task, remember to configure your cli-config.php properly.
+
++ Convert Mapping Information
Doctrine comes with some special tools for working with the various supported
@@ -179,4 +189,4 @@
> It will only detect Many-To-One relations (even if they are One-To-One) and
> will try to create entities from Many-To-Many tables. It also has problems
> with naming of foreign keys that have multiple column names. Any Reverse Engineered
-> Database-Schema needs considerable manual work to become a useful domain model.
\ No newline at end of file
+> Database-Schema needs considerable manual work to become a useful domain model.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment