MemoryRefresh!

Patterns / Active record   Active record



Questions Answers 0%

Pages   0 from 91
Questions   0 from 142

Reset


Active Record Pattern is used to encapsulate access to a data source.
<?php // Sql call to an abstract object (select) class Models_Article extends Zend_Db_Table { public function getArticles() { $sql = $this->select()->from('article'); } } // Table object class Zend_Db_Table { public function select() { $select = new Zend_Db_Table_Select($this); return $select; } public function insert() { } } // Select object class Zend_Db_Table_Select { public function from($name) { echo "SELECT * FROM {$name}"; // simplefied assemble for learning reasons } } $modelArticle = new Models_Article(); $modelArticle->getArticles();

Related Pages

Observer
Singleton
Front
Factory
Registry
Mvc
Active record


0% 100%
 
 
0 pages 91 pages
1) Active Record Pattern








Active Record Pattern is used to encapsulate access to a data source.
<?php // Sql call to an abstract object (select) class Models_Article extends Zend_Db_Table { public function getArticles() { $sql = $this->select()->from('article'); } } // Table object class Zend_Db_Table { public function select() { $select = new Zend_Db_Table_Select($this); return $select; } public function insert() { } } // Select object class Zend_Db_Table_Select { public function from($name) { echo "SELECT * FROM {$name}"; // simplefied assemble for learning reasons } } $modelArticle = new Models_Article(); $modelArticle->getArticles();

References









Programming

Php
   
Regex
   
MySQL
   
Css
   
jQuery
   
Git
   


References