Problems generating PHP entites from a database with tables. I am trying to generate entities, getters/setters and any associated annotations from tables already defined in a database.
I have been following several doctrine tutorials but cannot get the entities to successfully generate
Environment (windows xampp PHP 7.1): ZendFramework 3 skeleton application downloaded.
"zendframework/zend-component-installer" : "^1.0 || ^0.7 || ^1.0.0-dev@dev",
"zendframework/zend-mvc" : "^3.0.1",
"zfcampus/zf-development-mode" : "^3.0",
"zf-commons/zfc-user" : "^3.0",
"zendframework/zend-log" : "^2.9",
"doctrine/doctrine-orm-module" : "^1.1",
"zendframework/zend-json" : "^3.1"
from "App_Root" running the command below generates PHP classes with variable=>field mapping values for each table(note the directory matches namespace structure that is defined):
./vendor/doctrine/doctrine-module/bin/doctrine-module orm:convert-mapping --namespace="ModuleName\\Entity\\" --force --from-database annotation ./EXPORT
(files generated in /EXPORT/ModuleName/Entity)
So far so good. Now trying to generate the getters and any additional annotation data using
./vendor/doctrine/doctrine-module/bin/doctrine-module orm:generate:entities ./EXPORT/ModuleName/Entity
Produces:
[OK] No Metadata Classes to process.
For the life of me I cannot find any configuration with orm:generate:entities that points to some form of Metadata Classes... Is there a step I'm missing?
Adjusting the has no effect. Please note that to originally get this running I had to adjust the base config to even connect to the database (vendor/doctrine/doctine-orm-module/config/module.config.php) i.e. the script obviously did not pickup any config from the skeleton MVC application. I've tried installing ZFTool which has it's own issues when running from command line so this was a dead end for me(in zf3 anyway)
So far my options seem to be:
- Find a way to generate:entities to run via command line with the current tools
- Find a way to run the ORM tool with context of the ZF3 skeleton app trying to utilise the config
- Stick with at least the 'annotation' classes generated above and manually add getters/setters and continue... (not what I want to do)
- Dump doctrine and use /Zend/Db libraries with either TableGateway of customer Select() objects using DBAdapter.
http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/tools.html#configuration
How to generate entities from database schema using doctrine-orm-module and zf2
creating mapped ORM Entities without the cli?
Any assistance with a breakdown of steps would be great. Docs and posts online are not effective for me, possibly because I'm missing some simple configuration or directive...