Corrections sur Custom\Model, Entity et Manager
authorSébastien CHAZALLET <s.chazallet@gmail.com>
Thu, 15 Nov 2012 11:43:45 +0000 (12:43 +0100)
committerSébastien CHAZALLET <s.chazallet@gmail.com>
Thu, 15 Nov 2012 11:43:45 +0000 (12:43 +0100)
vendor/zf2biz/Custom/Model/Entity.php
vendor/zf2biz/Custom/Model/Manager.php

index 7788491..25f334d 100644 (file)
@@ -4,7 +4,7 @@ namespace Custom\Model;
 class Entity
 {
 
-    public function exchangeArray($data, $overwrite=true)
+    public function exchangeArray($data, $overwrite=false)
     {
         foreach($this->columns as $col) {
             if (array_key_exists($col, $data)) {
index e7ae619..c615e66 100644 (file)
@@ -89,11 +89,11 @@ abstract class Manager extends AbstractTableGateway
  
     public function save(Entity $entity)
     {
-        if ($this->is_new()) {
+        if ($this->is_new($entity)) {
             $this->insert(
                 $entity->toUpdatableArray()
             );
-        } elseif ($this->getGalerie(extract_primary($entity))) {
+        } elseif ($this->any($this->extract_primary($entity))) {
             $this->update(
                 $entity->toUpdatableArray(),
                 $entity->toPrimaryArray()