ZF2 Propel Integration - Google Groups

2 downloads 122 Views 105KB Size Report
Create autoload_classmap.php file. • Recommendation is to create one for each library, but you could have it consolida
ZF2 Propel Integration

Tasks Setup Directory Structure Create autoload_classmap.php for just Propel.php file Create autoload_classmap.php for Propel model classes Create module.config.php for module Add module to application.config.php Create Module.php file

Directory Structure In Zend Project • Vendor – Propel – configs – models • autoload_classmap.php • orm

– runtime

Create autoload_classmap.php for Propel.php

• Create autoload_classmap.php file • Recommendation is to create one for each library, but you could have it consolidated in one • Propel.php should be the only file listed in here • We are going to utilize Propel’s built-in autoloader for its own library files

Create autoload_classmap.php for Propel model classes Use command prompt to change the current working directory to one level above where the Propel generated model folder is (usually Propel project name specified in the parameter propel.project) models map orm ●

models

Your command prompt should be at: C:\path\to\models

orm map

om

other files

What is Classmap Generator?

Zend Framework created a utility to automatically map each PHP class in a folder - recursively

Run Classmap Generator

You should have a classmap file created

Create module.config.php

Yes, that is all you need

Configure application.config.php

Just add this line (Remember: Module namespace, top level vendor folder name, and this must all be the same or it will fail)

Create Module.php – Integration of ZF2 and Propel Namespace name must be the same as in the application.config.php as the name of the module being loaded and name of Vendor Folder (i.e. Propel) Initialize Propel and Database Connections Autoloading Propel.php and Propel OM classes

Add Zend Module Config

Keep In Mind • Your paths may vary so please double check them!

Give It a Try • Go to your controller and try (I used namespacing on mine so yours might differ)