Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

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.2k
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");
}