How can I set up ZfcUser module with Skeleton Application on ZF2, the first time, while using recommended practices?
1 Answers
So, basically ...
cd (main workspace)
Install latest composer from the get go
curl -s https://getcomposer.org/installer | php --
Download latest ZendSkeletonApplication
php composer.phar create-project -sdev --repository-url="https://packages.zendframework.com" zendframework/skeleton-application MyGreatApp
Move latest composer into the tree (overwriting one that was there)
mv composer.phar ./MyGreatApp
cd MyGreatApp
Check/Modify your existing .gitignore file within MyGreatApp
Remove git submodules (why)
git rm .gitsubmodules
Initialize repository:
git init
git add .
git commit –m “my initial commit of ZendSkeletonApplication”
Take a breather.
Now then, install your modules
This one won't hurt during development (optional):
php composer.phar require zendframework/zend-developer-tools:dev-master
cp vendor/zendframework/zend-developer-tools/config/zenddevelopertools.local.php.dist config/autoload/zdt.local.php
Install Doctrine: (note on composer versioning)
php composer.phar require doctrine/doctrine-orm-module:~0.7
Set up Database Connection Settings for Doctrine ORM:
Namely, go to Doctrine Connection Settings, and copy/paste/modify the example configuration file content into your config/autoload/doctrine.orm.local.php file within MyGreatApp folder.
*.local.php files will not be tracked by git as per ZF2, and will remain local to your personal repo. In this case, it is so DB-specific data is not copied to the main repo. You will have to recreate those files for any new repo you create.
Install Yer Zfc Components:
php composer.phar require zf-commons/zfc-user:~0.1
php composer.phar require zf-commons/zfc-user-doctrine-orm:~0.1
You do not need to create custom configuration files for the above two modules to work. (ref)
It is time:
Set up your Modules in config/application/application.config.php, something like
'modules' => array(
'ZendDeveloperTools',
'DoctrineModule',
'DoctrineORMModule',
'ZfcBase',
'ZfcUser',
'ZfcUserDoctrineORM',
'Application',
),
Try using Doctrine to set up your schema:
vendor/bin/doctrine-module orm:schema-tool:update --dump-sql
You may want to set up your database and users accordingly for this. And if that looks okay, do:
vendor/bin/doctrine-module orm:schema-tool:update --force
Now, go set up your localhost stuff and VirtualHost settings and go to http://localhost/MyGreatApp
/user and it should just work.
Proceed as normal. Comment, if it worked for you.