orm
orm copied to clipboard
Cannot load related entities through many to many relations via LEFT_JOIN
$select->load('many_to_many.has_many') failed with Undefined node 'has_many' exception.
$select->load('[email protected]_many') failed with Undefined relation 'pivotTestModel'.'has_many' exception.
This problem in AbstractLoader#251 in $node->getNode($relation) function.
In debug $node has this structure:

Here my models
/**
* @Entity
*/
class ManyToManyTestModel extends BaseTestModel
{
public function __construct(array $data = [])
{
$this->many_to_many_inverse = new PivotedCollection();
$this->has_many = new ArrayCollection();
parent::__construct($data);
}
/**
* @ManyToMany(though=PivotTestModel::class, target=HasManyTestModel::class)
*/
public $many_to_many_inverse;
/** @HasMany(target=RelatedModel::class, nullable=true) */
public $has_many;
}
/**
* @Entity
*/
class HasManyTestModel extends BaseTestModel
{
public function __construct(array $data = [])
{
$this->many_to_many = new PivotedCollection();
parent::__construct($data);
}
/**
* @ManyToMany(target=ManyToManyTestModel::class, though=PivotTestModel::class)
*/
public $many_to_many;
public $has_many_inverse;
}
/**
* @Entity
*/
class PivotTestModel
{
/** @Column(type="primary") */
public $id;
}
/**
* @Entity
*/
class RelatedModel extends BaseTestModel
{
}
----Update----
This behaviour exists when using LEFT_JOIN load method instead of POSTLOAD.
Can you provide isolated example or test case? I'm not sure what Base model is and what are you querying from database.