An error is raised if product insurer is empty, which obviously in view of the connection may be the case (left join). The error is No such field 'id'. Existing fields are {titre}
$sql = <<<SQL
SELECT
:projection
FROM
:lead lead
LEFT JOIN :lead_line lead_line_products ON lead_line_products.order_id = lead.id AND lead_line_products.type = 0
LEFT JOIN lead_line lead_line_options ON lead_line_options.order_id = lead.id AND lead_line_options.type = 1
LEFT JOIN :product_product ON lead_line_products.product_id = product_product.id
LEFT JOIN product_product options ON options.id = lead_line_options.product_id
LEFT JOIN :product_assureur ON product_product.assureur_id = product_assureur.id OR options.assureur_id = product_assureur.id
WHERE :condition
GROUP BY lead.id, product_assureur.*
ORDER BY $field $sorting
SQL;
$projection = $this->createProjection()->setField('product_assureur', 'product_assureur', '\Sel\Component\Model\****\PublicSchema\ProductAssureur');
Course results
foreach($results as $res) {
var_dump($res);
}
exit;
When a $res is null (because does not have an product insurer)
CRITICAL - Uncaught PHP Exception InvalidArgumentException: "No such field 'id'. Existing fields are {titre}" at /var/www/***/***/www/vendor/pomm-project/model-manager/sources/lib/Model/FlexibleEntity/FlexibleContainer.php line 64
Stack Trace
#1 in vendor/pomm-project/model-manager/sources/lib/Model/FlexibleEntity/FlexibleContainer.php at line 64
61. if (isset($this->container[$name]) || array_key_exists($name, $this->container)) {
62. $output[$name] = $this->container[$name];
63. } else {
64. throw new \InvalidArgumentException(
65. sprintf(
66. "No such field '%s'. Existing fields are {%s}",
67. $name,
#2 at FlexibleContainer ->fields (array('id'))
in vendor/pomm-project/model-manager/sources/lib/Model/IdentityMapper.php at line 50
50. return sha1(sprintf("%s|%s", serialize($entity->fields($primary_key)), get_class($entity)));
#3 at IdentityMapper ::getSignature (object(ProductAssureur), array('id'))
in vendor/pomm-project/model-manager/sources/lib/Model/IdentityMapper.php at line 65
63. public function fetch(FlexibleEntityInterface $entity, array $primary_key)
64. {
65. $signature = self::getSignature($entity, $primary_key);
#4 at IdentityMapper ->fetch (object(ProductAssureur), array('id'))
in vendor/pomm-project/model-manager/sources/lib/Converter/PgEntity.php at line 133
130. {
131. return $this
132. ->identity_mapper
133. ->fetch($entity, $this->row_structure->getPrimaryKey())
134. ;
135. }
#5 at PgEntity ->cacheEntity (object(ProductAssureur))
in vendor/pomm-project/model-manager/sources/lib/Converter/PgEntity.php at line 90
#6 at PgEntity ->fromPg (null, '\Sel\Component\Model\Fidanimo\PublicSchema\ProductAssureur', object(Session))
in vendor/pomm-project/model-manager/sources/lib/Model/HydrationPlan.php at line 173
#7 at HydrationPlan ->convert ('fromPg', ... 'product_assureur' => null))
in vendor/pomm-project/model-manager/sources/lib/Model/HydrationPlan.php at line 122
120. public function hydrate(array $values)
121. {
122. $values = $this->convert('fromPg', $values);
123. return $this->createEntity($values);
124. }
An error is raised if product insurer is empty, which obviously in view of the connection may be the case (left join). The error is No such field 'id'. Existing fields are {titre}
AutoStructure
Query
Course results
When a $res is null (because does not have an product insurer)
Stack Trace