]> git.andy128k.dev Git - ipf-legacy-orm.git/commitdiff
exclude relations from model forms
authorAndrey Kutejko <andy128k@gmail.com>
Thu, 4 Jul 2013 17:45:21 +0000 (20:45 +0300)
committerAndrey Kutejko <andy128k@gmail.com>
Thu, 4 Jul 2013 17:45:21 +0000 (20:45 +0300)
ipf/orm/import/builder.php
ipf/orm/import/schema.php

index ff9a5cb5d1119ed7a257e2c099c93f7e14a13469..d66b1b79185d07064436fd7c8d93ab6ec047b5ef 100644 (file)
@@ -257,6 +257,10 @@ class IPF_ORM_Import_Builder
                     $a[] = '\'owningSide\' => ' . self::varExport($relation['owningSide']);
                 }
 
+                if (isset($relation['exclude']) && $relation['exclude']) {
+                    $a[] = '\'exclude\' => ' . self::varExport($relation['exclude']);
+                }
+
                 if ( ! empty($a)) {
                     $ret[$i] .= ', ' . 'array(';
                     $length = strlen($ret[$i]);
index 9a461f08bf83cd1e127a99c3821c675dfd5b52b8..a17887d242523bb3d1602e07d4239b27b62b6724 100644 (file)
@@ -461,7 +461,7 @@ class IPF_ORM_Import_Schema
     protected function _autoCompleteOppositeRelations()
     {
         foreach($this->_relations as $className => $relations) {
-            foreach ($relations AS $alias => $relation) {
+            foreach ($relations as $alias => $relation) {
                 if ((isset($relation['equal']) && $relation['equal']) || (isset($relation['autoComplete']) && $relation['autoComplete'] === false)) {
                     continue;
                 }
@@ -469,14 +469,14 @@ class IPF_ORM_Import_Schema
                 $newRelation = array();
                 $newRelation['foreign'] = $relation['local'];
                 $newRelation['local'] = $relation['foreign'];
-                $newRelation['class'] = isset($relation['foreignClass']) ? $relation['foreignClass']:$className;
-                $newRelation['alias'] = isset($relation['foreignAlias']) ? $relation['foreignAlias']:$className;
-                $newRelation['exclude'] = isset($relation['foreignExclude']) ? $relation['foreignExclude']:$className;
-                
+                $newRelation['class'] = isset($relation['foreignClass']) ? $relation['foreignClass'] : $className;
+                $newRelation['alias'] = isset($relation['foreignAlias']) ? $relation['foreignAlias'] : $className;
+                $newRelation['exclude'] = isset($relation['foreignExclude']) ? $relation['foreignExclude'] : false;
+
                 // this is so that we know that this relation was autogenerated and
                 // that we do not need to include it if it is explicitly declared in the schema by the users.
                 $newRelation['autogenerated'] = true; 
-                
+
                 if (isset($relation['refClass'])) {
                     $newRelation['refClass'] = $relation['refClass'];
                     $newRelation['type'] = isset($relation['foreignType']) ? $relation['foreignType']:$relation['type'];