Rajout de la gestion des paires pour les select
[zf2.biz/galerie.git] / vendor / zf2biz / Custom / Model / Pair.php
diff --git a/vendor/zf2biz/Custom/Model/Pair.php b/vendor/zf2biz/Custom/Model/Pair.php
new file mode 100644 (file)
index 0000000..203fe8f
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+
+namespace Custom\Model;
+
+
+class Pair
+{
+    protected static $field_id = 'id';
+    protected static $field_name = 'name';
+
+    protected $id = null;
+    protected $name = null;
+
+    public function exchangeArray($data)
+    {
+        $this->id = $data[static::$field_id];
+        $this->name = $data[static::$field_name];
+    }
+
+    public function toArray() {
+        return array(
+            'id' => $this->id,
+            'name' => $this->name,
+        );
+    }
+
+    public function getArrayCopy() {
+        return array(
+            'id' => $this->id,
+            'name' => $this->name,
+        );
+    }
+
+}