function __construct(IdentifiableOrmEntity $parent, IQueryable $children, $readOnly = true) { Assert::isBoolean($readOnly); Assert::isTrue(!!$parent->getId(), 'cannot track children of unsaved parent'); $this->parent = $parent; $this->children = $children; $this->readOnly = $readOnly; $this->query = new EntityQuery($this->children); }