如何使用Doctrine createQuery来保护不相关的表?

时间:2015-01-22 20:16:56

标签: php doctrine-orm dql

有人能告诉我这段代码有什么问题吗?

        $em = $this->getEntityManager();

        $dql = <<<DQL
SELECT of, f, s
FROM MyBundle:OrgFeatures of
INNER JOIN of.feature f
INNER JOIN MyBundle:FeatureMasterLang s WITH s.featureMaster=f.id
WHERE of.orgPermissionset = :permissionsetId AND
s.lang = 1 AND
of.feature IN(:featureIds)
DQL;
        $query = $em->createQuery($dql)
            ->setParameter('permissionsetId', $permissionsetId)
            ->setParameter('featureIds', $featureIds);

        $resultSet = $query->getResult(\Doctrine\ORM\AbstractQuery::HYDRATE_ARRAY);

输出:

Array
(
    [0] => Array
        (
            [id] => 141
            [privateCreate] => 1
            [publicView] => 1
            [feature] => Array
                (
                    [createdAt] => 
                    [modifiedAt] => 
                    [deletedAt] => 
                    [id] => 1
                )

        )

    [1] => Array
        (
            [id] => 1
            [featureName] => Referrals
        )
    )
)

我需要将数组作为一个元素而不是两个,featureName数组中的[feature]。这可能吗?

0 个答案:

没有答案