Permalink
Browse files

Added ->getMap()->listRelationships() that return an informative arra…

…y about model relationships such as table data and others
  • Loading branch information...
1 parent fbbd714 commit 74d24c487decabcbc98da954f3ee9462cee1b3c6 @klederson committed Mar 26, 2012
Showing with 15 additions and 0 deletions.
  1. +15 −0 app/libs/Mapping/Map.php
View
@@ -245,6 +245,21 @@ public function addRelationship($relName,$relType,$foreignClass, $thisKey, $relK
return $this;
}
+
+ /**
+ * This method lists all relationships from a mapping and it's specifications
+ *
+ * @return Array
+ */
+ public function listRelationships() {
+ $rel = array();
+ foreach($this->fields as $index => $fieldInfo) {
+ if($this->isRelationship($index))
+ $rel[] = $fieldInfo;
+ }
+
+ return $rel;
+ }
public function isRelationship($index) {
if($this->fields[$index]['isRelationship'] == false) {

0 comments on commit 74d24c4

Please sign in to comment.