run install Doctrine ORM
create file composer.json
{
"require": {
"doctrine/orm": "*" ,
"symfony/yaml": "2.*"
}
}
download file composer.phar from WebSite Composer
https://getcomposer.org/
https://getcomposer.org/download/
I load by ...
php -r "readfile('https://getcomposer.org/installer');" | php
Note: must enable mod_openssl in c:\windows\php.ini or error !
extension=php_openssl.dll
then from myfolder
C:\Appserv\www\test_doctrine3\>
I run command
>php composer.phar install
this will install Doctrine and some component from Symphony2 ( Must connect to Internet )
after install will have folder vendor
C:\Appserv\www\test_doctrine3\vendor , this folder is all component that install by composer
I will work in folder
C:\Appserv\www\test_doctrine3
and
run command like
vendor\bin\doctrine orm:convert-mapping --from-database xml entities
Database Test with MySQL Server 5.x at localhost
NOTE
Main Official Tutorial Page
http://symfony.com/doc/current/book/doctrine.html
http://symfony.com/doc/current/cookbook/doctrine/reverse_engineering.html
http://symfony.com/doc/current/bundles/SensioGeneratorBundle/commands/generate_doctrine_entity.ht
REF ..
http://stackoverflow.com/questions/4844523/generating-mapping-information-on-existing-database-use-doctrine-2
Create XML from DB ( 4 Type of Entities , Equal )
vendor\bin\doctrine orm:convert-mapping --from-database xml entities
vendor\bin\doctrine orm:convert-mapping --from-database yml entities <--? (entities is subfolder )
vendor\bin\doctrine orm:convert-mapping --from-database php entities <--? NOT USE THIS !! , Cannot Read Code
vendor\bin\doctrine orm:convert-mapping --from-database annotation entities <-- This Create POJO Class !!!
Convert XML to YAML is
vendor\bin\doctrine orm:convert-mapping ???
Create PHP Class from DB
vendor\bin\doctrine orm:generate-entities .
Gen DATABASE from Entities ---- > YES , But Must Have Entities Class Too .
vendor\bin\doctrine orm:schema-tool:create
Show all commoand of orm
vendor\bin\doctrine orm:a
vendor\bin\doctrine orm:s
vendor\bin\doctrine orm:?
vendor\bin\doctrine orm:*
Show Help
vendor\bin\doctrine orm:info --help
C:\AppServ\www\test_doctrine>vendor\bin\doctrine orm:schema-tool:create --dump-
sql
CREATE TABLE dojos (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL,
PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = Inn
oDB;
CREATE TABLE starters (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NUL
L, dojo INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
============================================================
Note: PATH Struture
Folder PATH listing for volume OS
Volume serial number is 00330065 50A2:952B
C:.
+---dojos
+---entities
+---entities_backup
\---vendor
+---bin
+---composer
+---doctrine
| +---annotations
+---cache
| +---dbal
| +---inflector
| +---lexer
| \---orm
\---symfony
+---console
\---yaml
\---Symfony
=============================================================
C:\AppServ\www\test_doctrine3>dir
Volume in drive C is OS
Volume Serial Number is 50A2-952B
Directory of C:\AppServ\www\test_doctrine3
10/08/2014 03:37 PM <DIR> .
10/08/2014 03:37 PM <DIR> ..
10/08/2014 03:37 PM 7,362 a1.txt
10/08/2014 03:26 PM 641 bootstrap.php
10/07/2014 06:07 PM 431 cli-config.php
10/08/2014 03:08 PM 91 composer.json
10/08/2014 03:10 PM 22,878 composer.lock
10/07/2014 05:47 PM 1,029,188 composer.phar
10/08/2014 03:23 PM <DIR> dojos
10/08/2014 03:35 PM <DIR> entities
10/08/2014 02:50 PM <DIR> entities_backup
10/07/2014 06:25 PM 182 gen_xmlfrombase.bat
10/08/2014 03:39 PM 1,831 NOTE_ON_GENERATE.txt
10/08/2014 03:10 PM <DIR> vendor
8 File(s) 1,062,604 bytes
6 Dir(s) bytes free