Example #1
0
 public function convert($linkName, $linkParams, $entityName, $ormMeta)
 {
     $entityDefs = $this->getMetadata()->get('entityDefs');
     $foreignEntityName = $this->getLinkEntityName($entityName, $linkParams);
     $foreignLink = $this->getForeignLink($linkName, $linkParams, $entityDefs[$foreignEntityName]);
     $currentType = $linkParams['type'];
     $method = $currentType;
     if ($foreignLink !== false) {
         $method .= '_' . $foreignLink['params']['type'];
     }
     $method = Util::toCamelCase($method);
     $relationName = $this->isRelationExists($method) ? $method : $currentType;
     //relationDefs defined in separate file
     if (isset($linkParams['relationName']) && $this->isMethodExists($linkParams['relationName'])) {
         $className = $this->getRelationClass($linkParams['relationName']);
     } else {
         if ($this->isMethodExists($relationName)) {
             $className = $this->getRelationClass($relationName);
         }
     }
     if (isset($className) && $className !== false) {
         $helperClass = new $className($this->metadata, $ormMeta, $entityDefs);
         return $helperClass->process($linkName, $entityName, $foreignLink['name'], $foreignEntityName);
     }
     //END: relationDefs defined in separate file
     return null;
 }
Example #2
0
 protected function getSortEntities($entity1, $entity2)
 {
     $entities = array(Util::toCamelCase(lcfirst($entity1)), Util::toCamelCase(lcfirst($entity2)));
     sort($entities);
     return $entities;
 }