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

Can't obtain model's source from models list:

Hi, i have problem it said "Can't obtain model's source from models list: 'Modules\Backend\Models\LgxTransaction', when preparing: SELECT a.id, a.invoice, a.id_package, " this is my code:

__

 if ($invoice != "") {
            $where = "WHERE invoice = '".$invoice."'";
        }else{
            $where = "";
        }
        $query = ("
            SELECT 
            a.id,
            a.invoice,
            a.id_package,
            a.email,
            a.kode_voucher,
            a.harga,
            a.periode,
            a.method,
            a.status,
            a.start_date,
            a.end_date,
            a.create_login,
            a.create_date,
            b.caption as nama_package,
            b.keterangan
            FROM \Modules\Backend\Models\lgxTransaction a
            LEFT JOIN \Modules\Backend\Models\LgxMPackage b ON a.id_package = b.id
            $where
            ORDER BY a.id DESC 
            limit 100
            ");
        $row = $this->modelsManager->executeQuery($query);
        if($row->count() > 0) return $row;

__



85.5k

i am not sure but i think you need to call ->from("\MyNameSpace\ModelName") ?

$builder = $this->modelsManager->createBuilder()
                ->andWhere("created_at <= ?0", [$dt->getTimestamp()])
                ->andWhere("shown = 1")
                ->orderBy("created_at DESC")
                ->from('Blog\Models\Articles');


43.9k

Hi,

maybe typo error:

FROM \Modules\Backend\Models\lgxTransaction a

and

Can't obtain model's source from models list: 'Modules\Backend\Models\LgxTransaction



43.9k
edited May '18

otherwise, show \Modules\Backend\Models\LgxTransaction Model file and service defintion