System\Classes\DriverBehavior
Overview
DriverBehavior base class.
Extends
- System\Classes\ModelBehavior
- October\Rain\Database\ModelBehavior
- October\Rain\Extension\ExtensionBase
Public Properties
public string $driverFields
driverFields defines form fields for this driver
Show inherited public properties
Inherited Public Properties
- $extendableStaticCalledClass - is the calling class when using a static method. (defined in October\Rain\Extension\ExtensionBase)
Protected Properties
protected mixed $fieldConfig
fieldConfig is extra configuration for the converter type.
protected string $configPath
configPath specifies a path to the config directory.
Show inherited protected properties
Inherited Protected Properties
- $requiredProperties - that must exist in the model using this behavior. (defined in System\Classes\ModelBehavior)
- $model - Reference to the extended model. (defined in October\Rain\Database\ModelBehavior)
- $extensionHidden - are properties and methods that cannot be accessed. (defined in October\Rain\Extension\ExtensionBase)
Public Methods
public __construct()
public __construct($model = null): void
public defineDriverFormFields()
public defineDriverFormFields($form, $context = null): void
defineDriverFormFields should be called externally on the form widget. Do not override this method.
public defineFormFields()
public defineFormFields($form, $context = null): void
defineFormFields is an method for internal use to define fields used by this driver. Override this method to define form fields.
public getConfigPath()
public getConfigPath(
string $fileName,
mixed $configPath = null
): string
getConfigPath locates a file based on it's definition. If the file starts with the ~ symbol it will be returned in context of the application base path, otherwise it will be returned in context of the config path.
public getFieldConfig()
public getFieldConfig(): void
getFieldConfig returns the field configuration used by this model.
public getHostObject()
public getHostObject(): Shop\Models\CurrencyRate
getHostObject returns the host object with configuration.
public guessConfigPath()
public guessConfigPath(string $suffix = ''): string
guessConfigPath guesses the package path for the called class.
public guessConfigPathFrom()
public guessConfigPathFrom(string $class, string $suffix = ''): string
guessConfigPathFrom guesses the package path from a specified class.
public initDriverHost()
public initDriverHost(Model $host): void
initDriverHost when the converter is first created.
public makeConfig()
public makeConfig(
mixed $configFile = [],
array $requiredConfig = []
): object
makeConfig reads the contents of the supplied file and applies it to this object.
public makeConfigFromArray()
public makeConfigFromArray(array $configArray = []): stdClass
makeConfigFromArray makes a config object from an array, making the first level keys properties of a new object.
public mergeConfig()
public mergeConfig(mixed $configA, mixed $configB): stdClass
mergeConfig merges two configuration sources, either prepared or not, and returns them as a single configuration object.
public validateDriverHost()
public validateDriverHost(Model $host): void
validateDriverHost validates the host data before saving, this method can throw a ValidationException for invalid fields. For example:
throw new \ValidationException(['max_weight' => 'Max weight cannot be less than Min weight!']);
Inherited Public Methods
- extend() - this class with a closure. (defined in October\Rain\Extension\ExtensionBase)
- extensionApplyInitCallbacks() - (defined in October\Rain\Extension\ExtensionBase)
- extensionExtendCallback() - is a helper method for
::extend()static method. (defined in October\Rain\Extension\ExtensionBase) - extensionIsHiddenMethod() - (defined in October\Rain\Extension\ExtensionBase)
- extensionIsHiddenProperty() - (defined in October\Rain\Extension\ExtensionBase)
- getCalledExtensionClass() - (defined in October\Rain\Extension\ExtensionBase)
Protected Methods
protected getConfigValueFrom()
protected getConfigValueFrom($configObj, $name = null, $default = null): void
getConfigValueFrom will apply the config getter convention
Show inherited protected methods
Inherited Protected Methods
- extensionHideMethod() - (defined in October\Rain\Extension\ExtensionBase)
- extensionHideProperty() - (defined in October\Rain\Extension\ExtensionBase)