无法获取在PHP Phalcon中的Join查询中选择的列

时间:2017-02-18 00:29:50

标签: php phalcon

我正在使用Phalcon PHP框架。我是新来的。我尝试了以下方法来连接表并从这些表中选择列。但是,它只返回主表中的数据。

$jumpstarts = $this->modelsManager->createBuilder()
        ->columns("products.title, users_jumpstart.id, users_jumpstart.amount, invoices.user_id, invoices.product_id, invoices.created_at as billing_date, users.username")
        ->from(['users_jumpstart' => 'Models\Jumpstart'])
        ->leftJoin('Models\Invoices', "users_jumpstart.purchaseId=invoices.id", "invoices")
        ->leftJoin('Models\Users', "invoices.user_id=users.id", "users")
        ->leftJoin('Models\CoreProducts', "invoices.product_id=products.id", "products")
        ->where('users_jumpstart.userId=:user_id:', ['user_id' => 9])
        ->getQuery()
        ->execute();

它只返回users_jumpstart的列,即id和amount。 提前谢谢。

0 个答案:

没有答案