zend dynamic creating and using tables

339 views Asked by At

I need to automatically create tables with same structure each month and use a newest one but old tables should be readable. I think to make a table witch will contain names of this tables but how can I use in Zend_Db_Table_Abstract protected $_name of table that I need? I think to make something like

<?php 
class Application_Model_DbTable_ads extends Zend_Db_Table_Abstract

{

    /** Table name */

    protected $_name    = 'ads';


    public function __construct($name){

        parent::__construct();
        $this->_name = $name;

    }
}

Does Zend has something to manage this?

1

There are 1 answers

1
Bogdan Solomykin On

You can create table with prefix of year+month and concatenate table name with current year+month dynamically in code:

protected $_name = "table_name_" . date("Y-m");