Skip to content

Commit

Permalink
mapper/dbal: removed redundant createCollection() [closes #110] (BC b…
Browse files Browse the repository at this point in the history
…reak!)
  • Loading branch information
hrach committed Oct 10, 2015
1 parent 729fb49 commit b3146b0
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions src/Mapper/Dbal/DbalMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
use Nextras\Orm\Entity\IEntity;
use Nextras\Orm\Entity\IProperty;
use Nextras\Orm\Entity\Reflection\PropertyRelationshipMetadata;
use Nextras\Orm\Relationships\IRelationshipCollection;
use Nextras\Orm\Relationships\IRelationshipContainer;
use Nextras\Orm\Entity\Reflection\PropertyMetadata;
use Nextras\Orm\Mapper\BaseMapper;
use Nextras\Orm\Mapper\IMapper;
Expand Down Expand Up @@ -52,7 +50,7 @@ public function __construct(Connection $connection, IStorage $cacheStorage)
/** @inheritdoc */
public function findAll()
{
return $this->createCollection();
return new DbalCollection($this->getRepository(), $this->connection, $this->builder());
}


Expand All @@ -65,12 +63,6 @@ public function builder()
}


public function createCollection()
{
return new DbalCollection($this->getRepository(), $this->connection, $this->builder());
}


/** @inheritdoc */
public function toCollection($data)
{
Expand Down Expand Up @@ -109,7 +101,7 @@ public function getManyHasManyParameters(PropertyMetadata $sourceProperty, IMapp
public function createCollectionHasOne(PropertyMetadata $metadata, IEntity $parent)
{
return $this
->createCollection()
->findAll()
->setRelationshipMapping(
$this->getRelationshipMapperHasOne($metadata),
$parent
Expand All @@ -120,7 +112,7 @@ public function createCollectionHasOne(PropertyMetadata $metadata, IEntity $pare
public function createCollectionOneHasOneDirected(PropertyMetadata $metadata, IEntity $parent)
{
return $this
->createCollection()
->findAll()
->setRelationshipMapping(
$metadata->relationship->isMain
? $this->getRelationshipMapperHasOne($metadata)
Expand All @@ -134,7 +126,7 @@ public function createCollectionManyHasMany(IMapper $mapperTwo, PropertyMetadata
{
$targetMapper = $metadata->relationship->isMain ? $mapperTwo : $this;
return $targetMapper
->createCollection()
->findAll()
->setRelationshipMapping(
$this->getRelationshipMapperManyHasMany($mapperTwo, $metadata),
$parent
Expand All @@ -145,7 +137,7 @@ public function createCollectionManyHasMany(IMapper $mapperTwo, PropertyMetadata
public function createCollectionOneHasMany(PropertyMetadata $metadata, IEntity $parent)
{
return $this
->createCollection()
->findAll()
->setRelationshipMapping(
$this->getRelationshipMapperOneHasMany($metadata),
$parent
Expand Down

0 comments on commit b3146b0

Please sign in to comment.