public static function create($relationType, $relation, $relationParams, $primaryKeyName)
{
if ($relationType == 'hasOne') {
return self::hasOne($relation, $relationParams, $primaryKeyName);
}
if ($relationType == 'belongsTo') {
return self::belongsTo($relation, $relationParams);
}
if ($relationType == 'hasMany') {
return self::hasMany($relation, $relationParams, $primaryKeyName);
}
throw new InvalidArgumentException("Invalid relation type: {$relationType}");
}