Skip to content

Commit

Permalink
Fixed a couple of bugs. ZfcBase's Mapper still references the old Hyd…
Browse files Browse the repository at this point in the history
…ratorInterface, so we have to also. The delete function is defined differently in ZfcBase so it is now renamed deleteEntity. save, insertOnly and updateOnly are also brought into line as saveEntity, insertEntity and updateEntity.
  • Loading branch information
mtudor committed May 9, 2017
1 parent 0c17e23 commit fb87354
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/TccAbstractDbMapper/Mapper/AbstractDbMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Zend\Db\Sql\Select;
use Zend\Db\Sql\Where;
use Zend\Stdlib\ArrayUtils;
use Zend\Hydrator\HydratorInterface;
use Zend\Stdlib\Hydrator\HydratorInterface;
use Zend\Hydrator\ObjectProperty;
use ZfcBase\Mapper\AbstractDbMapper as ZfcBaseAbstractDbMapper;

Expand Down Expand Up @@ -133,7 +133,7 @@ public function fetchAll($asArray=false, $options = [])
*
* @return mixed|null The autogenerated id.
*/
public function insertOnly($entity)
public function insertEntity($entity)
{
return $this->insert($entity)->getGeneratedValue();
}
Expand All @@ -145,7 +145,7 @@ public function insertOnly($entity)
*
* @return null
*/
public function updateOnly($entity)
public function updateEntity($entity)
{
// Extract primary key values for update.
$pkValues = $this->getPrimaryKeyValuesFromEntity($entity);
Expand All @@ -164,13 +164,13 @@ public function updateOnly($entity)
*
* @return mixed|null The autogenerated id.
*/
public function save($entity)
public function saveEntity($entity)
{
try {
return $this->insertOnly($entity);
return $this->insertEntity($entity);
} catch (InvalidQueryException $e) {
// TODO: There is currently no warning if there is nothing to update.
return $this->updateOnly($entity);
return $this->updateEntity($entity);
}
}

Expand All @@ -179,7 +179,7 @@ public function save($entity)
*
* @return mixed
*/
public function delete($entity)
public function deleteEntity($entity)
{
// Get the primary keys from the entity.
$pkValues = $this->getPrimaryKeyValuesFromEntity($entity);
Expand Down

0 comments on commit fb87354

Please sign in to comment.