I am having a strange problem with Doctrine.
I need to query a simple table with only one inner join, which I have already done many times. But in this case, something strange: many lines are missing.
I have an object called Policy. It is linked to a table in my Oracle database. This table contains 81k + rows. When you query this object using the Doctrine query constructor, I get only 5k results. I made this query as simple as possible for testing:
$qb = $em->createQueryBuilder();
$qb->select('p')->from('ErwMonitoringExtranetBundle:Policy', 'p');
$query = $qb->getQuery();
$policiesFull = $query->getResult();
The $ policyFull variable contains only 5k elements. There are no duplicates in the table.
The SQL query generated by Doctrine is as follows:
SELECT
r0_.node_group_name AS NODE_GROUP_NAME0,
r0_.policy_name AS POLICY_NAME1,
r0_.policy_description AS POLICY_DESCRIPTION2,
r0_.policy_group_name AS POLICY_GROUP_NAME3,
r0_.policy_type_name AS POLICY_TYPE_NAME4,
r0_.policy_name_on_agent AS POLICY_NAME_ON_AGENT5,
r0_.date_last_maj AS DATE_LAST_MAJ6,
r0_.om_name AS OM_NAME7,
r0_.id_node AS ID_NODE8
FROM
ewintranet.ref_monitored_ci;
Executing the exact same query in Oracle returns the full contents of the table.
:
$qb = $em->createQueryBuilder();
$qb->select('count(p)')->from('ErwMonitoringExtranetBundle:Policy', 'p');
$query = $qb->getQuery();
echo $query->getSingleScalarResult();
81k.
- , getResult()?