X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;f=vendor%2Fzf2biz%2FCustom%2FModel%2FEntity.php;fp=vendor%2Fzf2biz%2FCustom%2FModel%2FEntity.php;h=7788491c34028d879dca52e9b06e1521204afb2e;hb=3a8463aa368c12c7f159de91e11c3046c2ab783e;hp=0000000000000000000000000000000000000000;hpb=11f416fd595920a9cc89a5a938195d906d8f4ebc;p=zf2.biz%2Fapplication_blanche.git diff --git a/vendor/zf2biz/Custom/Model/Entity.php b/vendor/zf2biz/Custom/Model/Entity.php new file mode 100644 index 0000000..7788491 --- /dev/null +++ b/vendor/zf2biz/Custom/Model/Entity.php @@ -0,0 +1,41 @@ +columns as $col) { + if (array_key_exists($col, $data)) { + $this->$col = $data[$col]; + } elseif ($overwrite) { + $this->$col = null; + } + } + } + + public function toArray() { + $result = array(); + foreach($this->columns as $col) { + $result[$col] = $this->$col; + } + return $result; + } + + public function toUpdatableArray() { + $result = array(); + foreach($this->updatable_columns as $col) { + $result[$col] = $this->$col; + } + return $result; + } + + public function toPrimaryArray() { + $result = array(); + foreach($this->primary_columns as $col) { + $result[$col] = $this->$col; + } + return $result; + } +}