We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Multiple table but using 1 models

i have tables name transactions_daily.

everyday, this table will backup automatically and creating a table called transactions_daily_xx_xx_xx.

can i have this table accessed without creating models everyday just to access this table. or are there any solutions to read many of the same kind table with just 1 models ?

edited Aug '17
**
     * Returns table name mapped in the model.
     *
     * @return string
     */
    public function getSource()
    {
        return 'your_table_name_here';
    }

So you need to supply table name on your model, e.g. via setSource() method. Then just change return of getSource() accordingly.


    private $_source;

    function setSource(string $tbl = null)
    {
        $this->_source = $tbl;
        return true;
    }

    function getSource()
    {
        return $this->_source;
    }

    $model = new MyModelInstance(); 
    $model->setSource('yourDynamicTableNameHere');