Alex Tech Adventures The webs best tutorials!

Welcome, Guest
Please Login or Register.    Lost Password?

DataMapper pattern with Zend Framework
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: DataMapper pattern with Zend Framework
#731
DataMapper pattern with Zend Framework 1 Year, 5 Months ago Karma: 16
** This thread discusses the content article: DataMapper pattern with Zend Framework **

alexanderrv
Administrator
Posts: 279
graph
User Offline Click here to see the profile of this user
Gender: Male tmthv2 alexchatonly@hotmail.com Location: Freeport, Bahamas Birthdate: 1989-04-14
The administrator has disabled public write access.
 
#737
Re: DataMapper pattern with Zend Framework 1 Year, 5 Months ago Karma: 0
It is possible to declare the getInstance() function from within your abstract mapper if using PHP 5.3.0:

Code:


abstract class App_Model_AbstractMapper {
    public static function getInstance() {
        $name = get_called_class();
        if(is_null($name::$_instance)) {
            $name::$_instance = new $name();
        }
        
        return $name::$_instance;
    }
}

class App_Model_ProjectMapper extends App_Model_AbstractMapper {
    protected static $_instance = null;
}



But you still have to declare a protected $_instance property within your child classes, not perfect but cuts down on some of the code repetition.

Very interesting tutorial, certainly helped me out with my project! The video is on the lengthy side though, and totalling 532MB! I found it more helpful downloading the video after a bit of rooting in your source. Perhaps it would be a good idea to provide a link to download the video? Just a thought!
synforge
Fresh Boarder
Posts: 1
graphgraph
User Offline Click here to see the profile of this user
Last Edit: 2010/08/25 16:19 By synforge.
The administrator has disabled public write access.
 
#738
Re: DataMapper pattern with Zend Framework 1 Year, 5 Months ago Karma: 16
thanks for the tip
Video download links are already available in the archives
alexanderrv
Administrator
Posts: 279
graph
User Offline Click here to see the profile of this user
Gender: Male tmthv2 alexchatonly@hotmail.com Location: Freeport, Bahamas Birthdate: 1989-04-14
The administrator has disabled public write access.
 
Go to topPage: 1
Moderators: alexanderrv
You are here: Home Forum

Statistics

Members : 1401
Content : 42
Web Links : 1
Content View Hits : 191196

Poll

Interested in TinyBrowser and TinyMce plugin for ZF?
 

Who's Online

We have 50 guests online