Func
Func
Represents a database function for migration actions.
class Func extends \Hazaar\DBI\Manager\Migration\Action\BaseActionExtends: Hazaar\DBI\Manager\Migration\Action\BaseAction
Encapsulates function attributes such as name, return type, parameters, language, and body. Provides methods for creating, altering, dropping, applying, and diffing functions in migration processes.
Properties
name
The name of the function.
public string $nameType: string
returnType
The return type of the function.
public string $returnTypeType: string
params
The parameters of the function.
public array $paramsType: array
lang
The language of the function implementation (e.g., SQL, PLPGSQL).
public string $langType: string
body
The body of the function.
public string $bodyType: string
Methods
create
Creates the function in the database.
public create(Adapter $dbi, ?string $user): boolReturns: bool
Throws an exception if the function body is not set.
Parameters
| Parameter | Type | Description |
|---|---|---|
$dbi | Hazaar\DBI\Adapter | the database adapter instance |
$user | string | the user to grant execute permissions to, or null for no grants |
alter
Alters the function in the database.
public alter(Adapter $dbi): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$dbi | Hazaar\DBI\Adapter | the database adapter instance |
drop
Drops the function from the database.
public drop(Adapter $dbi): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$dbi | Hazaar\DBI\Adapter | the database adapter instance |
apply
Applies changes from another function action to this one.
public apply(BaseAction $action): boolReturns: bool
Updates the function body if the provided action is an instance of this class.
Parameters
| Parameter | Type | Description |
|---|---|---|
$action | Hazaar\DBI\Manager\Migration\Action\BaseAction | the action to apply changes from |
diff
Finds the difference between this function and another action.
public diff(BaseAction $action): ?BaseActionReturns: Hazaar\DBI\Manager\Migration\Action\BaseAction
Returns the other action if the function bodies differ, otherwise null.
Parameters
| Parameter | Type | Description |
|---|---|---|
$action | Hazaar\DBI\Manager\Migration\Action\BaseAction | the action to compare against |
Generated by Hazaar API Doc Generator on Fri, 04 Sep 2026 23:32:16 +0000