Jump to content

quick lesson in oop please.


ballhogjoni

Recommended Posts

I think I know a good bit of oop but don't know if I can do this. I tried it, but its not working. When I call the saveDomain() from the indexAction() within the indexController I expect to get the name of the table, which in this case, is Domains. Any help, thanks? oh ya, i am using php 5

 

indexController

class IndexController extends Zend_Controller_Action{

    function init(){
        $this->domain = new Domain();
    }

function indexAction(){
	$this->view->base_url = BASE_URL;
        $this->domain->saveDomain( BASE_URL );
}
}

 

domain model

class Domain extends Zend_Db_Table_Abstract {

    protected $_name = 'Domains';
    protected $_primary = 'id';
    var $db;

    function init(){
        $this->crud = new Crud( array($this->_name) );
    }
  
  function saveDomain( $domain ) {
        $this->crud->Read();
    }
}

 

crud model

class Crud extends Zend_Registry {

    var $db;
    var $_tableName;

    static function init( $tableName ){
        $this->db = parent::get('db');
        $this->_tableName = $tableName;
    }

    /*
     * 
     */
    public function Read( $condition = null, $sql = null ) {
        echo "<pre>"; print_r($this->_tableName);echo"</pre>";
    }
}

Link to comment
https://forums.phpfreaks.com/topic/157899-quick-lesson-in-oop-please/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.