protected function createRelationshipMapper($type, PropertyMetadata $metadata, IMapper $otherMapper = null)
{
switch ($type) {
case Relationship::MANY_HAS_ONE:
return new RelationshipMapperManyHasOne($this->connection, $this, $metadata);
case Relationship::ONE_HAS_ONE:
return new RelationshipMapperOneHasOne($this->connection, $this, $metadata);
case Relationship::MANY_HAS_MANY:
return new RelationshipMapperManyHasMany($this->connection, $this, $otherMapper, $metadata);
case Relationship::ONE_HAS_MANY:
return new RelationshipMapperOneHasMany($this->connection, $this, $metadata);
default:
throw new InvalidArgumentException();
}
}