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

upgrade to phlacon4

Hello I am trying to upgrade from phalcon3 (with incubator) to phalcon4 and a few things have changed....

ENV PHP7.3

It was required to remove the getSource() function (in all models)

public function getSource() {
    return 'Users';
}

but now i get the error

Table 'users' doesn't exist in database when dumping meta-data for Users

i have read somewhere to add in initialize()

$this->getModelsManager()->setModelSchema($this, 'DatabaseName');

but now a new error shows up

Table 'DatabaseName'.'users' doesn't exist in database when dumping meta-data for Users

what I understand is the table name is wrong (its not capitalise). Any other way to classify a model to a table name as it was possiblem in phalcon3?

Thx



5.3k
Accepted
answer

here is what i have done...

installed devtools 4.0.3 and created a project, then a created a model.

https://github.com/phalcon/phalcon-devtools

the solution, migrate from

public function getSource() {
    return 'Users';
}

to

public function initialize() {
    $this->setSource("Users");
}