Exemple #1
0
 /**
  * @return string|null "LHS" or "RHS" depending on the side of the relationship this link represents
  */
 public function getSide()
 {
     //First try the relationship
     if ($this->relationship->getLHSLink() == $this->name && $this->relationship->getLHSModule() == $this->focus->module_name) {
         return REL_LHS;
     }
     if ($this->relationship->getRHSLink() == $this->name && $this->relationship->getRHSModule() == $this->focus->module_name) {
         return REL_RHS;
     }
     //Next try the vardef
     if (!empty($this->def['side'])) {
         if ((strtolower($this->def['side']) == 'left' || $this->def['side'] == REL_LHS) && (empty($this->relationship->def['join_key_lhs']) || $this->name != $this->relationship->def['join_key_lhs'])) {
             return REL_LHS;
         } else {
             return REL_RHS;
         }
     } else {
         if (!empty($this->def['id_name'])) {
             //Next try using the id_name and relationship join keys
             if (isset($this->relationship->def['join_key_lhs']) && $this->def['id_name'] == $this->relationship->def['join_key_lhs']) {
                 return REL_RHS;
             } else {
                 if (isset($this->relationship->def['join_key_rhs']) && $this->def['id_name'] == $this->relationship->def['join_key_rhs']) {
                     return REL_LHS;
                 }
             }
         }
     }
     Log::error("Unable to get proper side for link {$this->name}");
 }