public function testToCamelCase() { $this->assertEquals('detail', Util::toCamelCase('detail')); $this->assertEquals('detailView', Util::toCamelCase('detail-view', '-')); $this->assertEquals('myDetailView', Util::toCamelCase('my_detail_view')); $input = array('detail', 'my_detail_view'); $result = array('detail', 'myDetailView'); $this->assertEquals($result, Util::toCamelCase($input)); }
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']; $relType = $currentType; if ($foreignLink !== false) { $relType .= '_' . $foreignLink['params']['type']; } $relType = Util::toCamelCase($relType); $relationName = $this->isRelationExists($relType) ? $relType : $currentType; //relationDefs defined in separate file if (isset($linkParams['relationName'])) { $className = $this->getRelationClass($linkParams['relationName']); if (!$className) { $relationName = $this->isRelationExists($relType) ? $relType : $currentType; $className = $this->getRelationClass($relationName); } } else { $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; }
protected function getSortEntities($entity1, $entity2) { $entities = array(Util::toCamelCase(lcfirst($entity1)), Util::toCamelCase(lcfirst($entity2))); sort($entities); return $entities; }