private function assertRelationshipsExist(TableNode $table, $type) { $relations = $this->aujaConfigurator->getRelations(); foreach ($table->getHash() as $relationHash) { $leftModelName = $relationHash['left']; $rightModelName = $relationHash['right']; if (!isset($relations[$leftModelName])) { throw new Exception(sprintf('No relations for model %s', $leftModelName)); } $modelRelations = $this->aujaConfigurator->getRelationsForModel($this->aujaConfigurator->getModel($leftModelName)); $relationshipExists = false; foreach ($modelRelations as $relation) { if ($relation->getType() == $type && $relation->getRight()->getName() == $rightModelName) { $relationshipExists = true; } } if (!$relationshipExists) { throw new Exception(sprintf('There is no %s relationship between %s and %s.', $type, $leftModelName, $rightModelName)); } } }