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

Model could not be loaded

Hi,

i try to create a join but the model could not be loaded:

Controller

    use Vokuro\Models\Country;
    use Vokuro\Models\Region;

   $this->modelsManager->createBuilder()
        ->from("Country")
        ->join("Region")
        ->orderBy("Country.country")
        ->getQuery()
        ->execute();

thx



1.9k
Accepted
answer

Use namespaces in from and join also

AS @ntesic said, use the full namespaces in the queryBuilder parameters. From clause should be ->from("Vokuro\Models\Country"). You are registering the namespeces in your contrller, but query builder does not know about them :)



59.9k

Thx a lot will try it next year :-)

Best to you for 2017.



59.9k

Thx to you, now it works. Happy new year.