0

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?

user1927652
  • 91
  • 1
  • 5

1 Answers1

0

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");
  • You want to read from all tables oldest and newest? In this case you can create a merge table and read from there http://dev.mysql.com/doc/refman/5.0/en/merge-storage-engine.html – Bogdan Solomykin Sep 13 '13 at 08:16