Just resurrected this site, Word Press still rocks, and I am still focused on my work projects…but I will loop over here and update as time goes on.
Time flies, we built the ASF over 4 years ago, it has performed without a hitch for over 4 years. We migrated all 10K+ lines of code over to standard libraries over the last year, and have entered a new phase of the business.
In the process, there are about a hundred cool ideas that have come up using this technology, so I hope to implement some of them here. It turns out that a year ago I wrote all of the stuff that I needed, so stay tuned.
Status
January 10th, 2009 · No Comments
→ No CommentsTags: Uncategorized
Generic Action Controller
October 2nd, 2007 · No Comments
When moving our data warehouse application (8-10K lines) into the Zend Framework, it turns out that it is a process of extension the consolidation (should write that up later, hmm). But, there are a lot of action controllers to write the first time through–we then consolidated. So it was helpful to create a skeleton to use, here is mine:
<?php /** Ye Olde Generic Action Controller outline **/ /** Zend_Controller_Action */ require_once 'Zend/Controller/Action.php'; class genericController extends Zend_Controller_Action { //set up the controller here, view initilization and such public function init(){} //do stuff here that you need before and action public function preDispatch(){} //do stuff here that you need after the action public function postDispatch(){} //...functions for explicit actions here //this is where a action winds up if it is not explicitly defined public function __call($method, $args){} }
→ No CommentsTags: Zend Framework
An Updated SQLite Example
October 2nd, 2007 · No Comments
I recently needed an example for using SQLite in the Zend Framework 1.02, so I had to modify the “Hidden Gems” version, and show some more of the fetch commands, so here it is.
<?php /** Zend_Controller_Action */ require_once 'Zend/Controller/Action.php'; class IndexController extends Zend_Controller_Action { //no rendering needed, we are going to use debug dump $this->getFrontController()->setParam('noViewRenderer', true); //load zend db class Zend_Loader::loadClass('Zend_Db'); //watch the trick to get it to run on older php instances $params = array ('dbname' => ':memory:', 'sqlite2'=>1); //get the PDO $db = Zend_Db::factory('PDO_SQLITE', $params); //create the memory table $db->query("CREATE TABLE server (key, value)"); //statement $stmt = $db->prepare( "INSERT INTO server (key, value) VALUES (:key, :value)" ); //use server keys since we all got em foreach ( $_SERVER as $key => $value ){ if(!is_string($value)) continue; //next if aint string //junk values since we are online $stmt->execute( array(':key'=>uniqid(), ':value'=>uniqid())); //use the following on your localhost box //$stmt->execute( array(':key'=>$key, ':value'=>$value)); } //fetch one $data = $db->fetchOne( 'SELECT key, value FROM server' ); Zend_Debug::dump( $data, '<b>Fetch one:</b><br/>' ); //fetch row $data = $db->fetchRow( 'SELECT key, value FROM server' ); Zend_Debug::dump( $data, '<b>Fetch row:</b><br/>' ); //fetch pairs $data = $db->fetchPairs( 'SELECT key, value FROM server' ); Zend_Debug::dump( $data, '<b>Fetch pairs:</b><br/>' ); //fetch assoc $data = $db->fetchAssoc( 'SELECT key, value FROM server' ); Zend_Debug::dump( $data, '<b>Fetch assoc:</b><br/>' ); //fetch all $data = $db->fetchAll( 'SELECT key, value FROM server' ); Zend_Debug::dump( $data, '<b>Fetch all:</b><br/>' ); } }