コード例 #1
0
 static function getFieldNameAlias($field)
 {
     $mod = self::loadModification($field);
     if (substr($field['field_name'], -3) == '_id') {
         if ($name = LsVersionable::getRelationAliasByModelAndFieldName($mod['object_model'], $field['field_name'])) {
             return $name;
         }
     }
     return null;
 }
コード例 #2
0
ファイル: Entity.class.php プロジェクト: silky/littlesis
 public function getRelationAliasByFieldName($fieldName)
 {
     $object = $this->getInvoker();
     $table = $object->getTable();
     foreach ($table->getRelations() as $name => $relation) {
         if ($relation->getLocalFieldName() == $fieldName) {
             return $name;
         }
     }
     foreach ($this->_extensionObjects as $name => $object) {
         if ($name = LsVersionable::getRelationAliasByRecordAndFieldName($object, $fieldName)) {
             return $name;
         }
     }
     return null;
 }