]> git.andy128k.dev Git - ipf-legacy-orm.git/commitdiff
configure exclusion of order field
authorAndrey Kutejko <andy128k@gmail.com>
Tue, 2 Jul 2013 20:40:24 +0000 (23:40 +0300)
committerAndrey Kutejko <andy128k@gmail.com>
Tue, 2 Jul 2013 20:40:24 +0000 (23:40 +0300)
ipf/orm/template/orderable.php

index 0d26546c354b599ac8fe9ef91066cb5a212f7f54..327082853ca886e160730ba9e5d870a2b0b1f7cb 100644 (file)
@@ -3,11 +3,16 @@
 class IPF_ORM_Template_Orderable extends IPF_ORM_Template
 {
     private $columnName = 'ord';
+    private $exclude = true;
 
     public function __construct(array $options=array())
     {
-        if ($options && array_key_exists('name', $options))
-            $this->columnName = $options['name'];
+        if ($options) {
+            if (array_key_exists('name', $options))
+                $this->columnName = $options['name'];
+            if (array_key_exists('exclude', $options))
+                $this->exclude = $options['exclude'];
+        }
     }
 
     public function getColumnName()
@@ -17,7 +22,7 @@ class IPF_ORM_Template_Orderable extends IPF_ORM_Template
 
     public function setTableDefinition()
     {
-        $this->hasColumn($this->columnName, 'integer', null, array('exclude' => true));
+        $this->hasColumn($this->columnName, 'integer', null, array('exclude' => $this->exclude));
         $this->getTable()->listeners['Orderable_'.$this->columnName] = new IPF_ORM_Template_Listener_Orderable($this->columnName);
     }
 }