/** * @param $onTableAliasName * @param bool $canUseFromJoins * @return null|string * @throws NotImplementedException */ protected function resolveJoinsForInferredRelation($onTableAliasName, $canUseFromJoins = true) { assert('is_string($onTableAliasName)'); assert('is_bool($canUseFromJoins)'); //First cast up $onTableAliasName = $this->resolveJoinsForInferredRelationThatIsCastedUp($onTableAliasName, $canUseFromJoins); //Second build relation across to the opposing model $onTableAliasName = $this->resolveJoinsForForARelationAttributeThatIsManyToMany($onTableAliasName); //Casting down should always be necessary since that is the whole point of using a referred relation $opposingRelationModelClassName = $this->modelAttributeToDataProviderAdapter->getRelationModelClassName(); if ($opposingRelationModelClassName != 'Item') { throw new NotImplementedException(); } $inferredRelationModelClassName = $this->modelAttributeToDataProviderAdapter->getInferredRelationModelClassName(); $onTableAliasName = $this->resolveAndProcessLeftJoinsForAttributeThatIsCastedDownOrUp($opposingRelationModelClassName, $inferredRelationModelClassName, $onTableAliasName); return $onTableAliasName; }