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

change table of model

$this->setSource('anthor_table');
$result = self::find(array(
                'conditions' => "addtime BETWEEN $begin AND $end",
                'columns' => 'optid',
                'group' => 'optid'
        ));
// The table of sql is no changed, How can I do it?

I believe that setSource needs to be ran inside of the initialize() method of the model per Andres commentary in this thread:

https://forum.phalcon.io/discussion/108/setsource-in-the-model-initializer

Nikolaus provides an even more detailed answer here:

https://stackoverflow.com/questions/14042971/what-is-the-most-correct-way-to-define-source-table-in-phalcon-mvc-model