[Solar-svn] Revision 3196

pmjones at solarphp.com pmjones at solarphp.com
Mon Jun 2 20:57:31 CDT 2008


Solar_Model_(Areas|Nodes|Taggings|Tags): [CHG] Now that inflection is in place, we don't need to specify the foreign_class and foreign_key values explicitly.



Modified: trunk/Solar/Model/Areas.php
===================================================================
--- trunk/Solar/Model/Areas.php	2008-06-03 01:52:25 UTC (rev 3195)
+++ trunk/Solar/Model/Areas.php	2008-06-03 01:57:31 UTC (rev 3196)
@@ -75,7 +75,7 @@
          * Relationships.
          */
         $this->_hasMany('nodes', array(
-            'foreign_class' => 'nodes',
+            // use a non-standard foreign key
             'foreign_key'   => 'parent_id',
         ));
         

Modified: trunk/Solar/Model/Nodes.php
===================================================================
--- trunk/Solar/Model/Nodes.php	2008-06-03 01:52:25 UTC (rev 3195)
+++ trunk/Solar/Model/Nodes.php	2008-06-03 01:57:31 UTC (rev 3196)
@@ -150,21 +150,12 @@
         /**
          * Relationships.
          */
-        $this->_belongsTo('area', array(
-            'foreign_class' => 'areas',
-            'foreign_key'   => 'area_id',
-            'eager'         => false,
-        ));
+        $this->_belongsTo('area');
         
-        $this->_hasMany('taggings', array(
-            'foreign_class' => 'taggings',
-            'foreign_key'   => 'node_id',
-        ));
+        $this->_hasMany('taggings');
         
         $this->_hasMany('tags', array(
-            'foreign_class' => 'tags',
-            'through'       => 'taggings',
-            'through_key'   => 'tag_id',
+            'through' => 'taggings',
         ));
     }
     

Modified: trunk/Solar/Model/Taggings.php
===================================================================
--- trunk/Solar/Model/Taggings.php	2008-06-03 01:52:25 UTC (rev 3195)
+++ trunk/Solar/Model/Taggings.php	2008-06-03 01:57:31 UTC (rev 3196)
@@ -38,14 +38,8 @@
             'tag_id'  => 'int',
         );
         
-        $this->_belongsTo('node', array(
-            'foreign_class' => 'nodes',
-            'foreign_key'   => 'node_id',
-        ));
+        $this->_belongsTo('node');
         
-        $this->_belongsTo('tag', array(
-            'foreign_class' => 'tags',
-            'foreign_key'   => 'tag_id',
-        ));
+        $this->_belongsTo('tag');
     }
 }

Modified: trunk/Solar/Model/Tags.php
===================================================================
--- trunk/Solar/Model/Tags.php	2008-06-03 01:52:25 UTC (rev 3195)
+++ trunk/Solar/Model/Tags.php	2008-06-03 01:57:31 UTC (rev 3196)
@@ -60,15 +60,10 @@
         /**
          * Relationships.
          */
-        $this->_hasMany('taggings', array(
-            'foreign_class' => 'taggings',
-            'foreign_key'   => 'tag_id',
-        ));
+        $this->_hasMany('taggings');
         
         $this->_hasMany('nodes', array(
-            'foreign_class' => 'nodes',
-            'through'       => 'taggings',
-            'through_key'   => 'node_id',
+            'through' => 'taggings',
         ));
     }
     




More information about the Solar-svn mailing list