MemoryRefresh!

Patterns / Factory   Factory



Questions Answers 0%

Pages   0 from 91
Questions   0 from 142

Reset


Factory Method Pattern use a generic class (the factory) for managing specialized classes.
<?php $db = Zend_Db::factory('PDO_MYSQL', array( 'host' => 'localhost', 'username' => 'root', 'password' => '', 'dbname' => 'testdb', )); class Zend_Db { public function factory($adapter, $config = array()) { $class = "Zend_Db_Adapter_{$adapter}"; // --- Look Here --- // /* Zend/Db/Adapter/ PDO/ Mysql/ Sqlite/ Oracle/ */ $class::connect(); } } class Zend_Db_Adapter_PDO_MYSQL { public function connect() { echo "connected"; } }

Related Pages

Observer
Singleton
Front
Factory
Registry
Mvc
Active record


0% 100%
 
 
0 pages 91 pages
1) Factory Method Pattern








Factory Method Pattern use a generic class (the factory) for managing specialized classes.
<?php $db = Zend_Db::factory('PDO_MYSQL', array( 'host' => 'localhost', 'username' => 'root', 'password' => '', 'dbname' => 'testdb', )); class Zend_Db { public function factory($adapter, $config = array()) { $class = "Zend_Db_Adapter_{$adapter}"; // --- Look Here --- // /* Zend/Db/Adapter/ PDO/ Mysql/ Sqlite/ Oracle/ */ $class::connect(); } } class Zend_Db_Adapter_PDO_MYSQL { public function connect() { echo "connected"; } }

References









Programming

Php
   
Regex
   
MySQL
   
Css
   
jQuery
   
Git
   


References