LocationModel
extends ModelBehavior
in package
Location model extension
Adds Country and State relations to a model
Usage:
In the model class definition:
public $implement = ['RainLab.Location.Behaviors.LocationModel'];
Table of Contents
- $extendableStaticCalledClass : string
- $extensionCallbacks : array<string|int, mixed>
- $extensionHidden : mixed
- $model : Model
- $requiredProperties : array<string|int, mixed>
- __construct() : mixed
- Constructor
- extend() : mixed
- extensionApplyInitCallbacks() : mixed
- extensionExtendCallback() : void
- Helper method for `::extend()` static method
- extensionIsHiddenField() : mixed
- extensionIsHiddenMethod() : mixed
- getCalledExtensionClass() : mixed
- getCountryCodeAttribute() : string
- Mutator for "country_code" attribute.
- getCountryOptions() : mixed
- getStateCodeAttribute() : string
- Mutator for "state_code" attribute.
- getStateOptions() : mixed
- setCountryCodeAttribute() : mixed
- Sets the "country" relation with the code specified, model lookup used.
- setCountryIdAttribute() : mixed
- Ensure an integer value is set, otherwise nullable.
- setStateCodeAttribute() : mixed
- Sets the "state" relation with the code specified, model lookup used.
- setStateIdAttribute() : mixed
- Ensure an integer value is set, otherwise nullable.
- extensionHideField() : mixed
- extensionHideMethod() : mixed
Properties
$extendableStaticCalledClass
public
static string
$extendableStaticCalledClass
= null
The calling class when using a static method.
$extensionCallbacks
protected
static array<string|int, mixed>
$extensionCallbacks
= []
Used to extend the constructor of an extension class. Eg:
BehaviorClass::extend(function($obj) { })
$extensionHidden
protected
mixed
$extensionHidden
= ['fields' => [], 'methods' => ['extensionIsHiddenField', 'extensionIsHiddenMethod']]
$model
protected
Model
$model
Reference to the extended model.
$requiredProperties
protected
array<string|int, mixed>
$requiredProperties
= []
Properties that must exist in the model using this behavior.
Methods
__construct()
Constructor
public
__construct(mixed $model) : mixed
Parameters
- $model : mixed
-
The extended model.
Return values
mixed —extend()
public
static extend(callable $callback) : mixed
Parameters
- $callback : callable
Return values
mixed —extensionApplyInitCallbacks()
public
extensionApplyInitCallbacks() : mixed
Return values
mixed —extensionExtendCallback()
Helper method for `::extend()` static method
public
static extensionExtendCallback(callable $callback) : void
Parameters
- $callback : callable
Return values
void —extensionIsHiddenField()
public
extensionIsHiddenField(mixed $name) : mixed
Parameters
- $name : mixed
Return values
mixed —extensionIsHiddenMethod()
public
extensionIsHiddenMethod(mixed $name) : mixed
Parameters
- $name : mixed
Return values
mixed —getCalledExtensionClass()
public
static getCalledExtensionClass() : mixed
Return values
mixed —getCountryCodeAttribute()
Mutator for "country_code" attribute.
public
getCountryCodeAttribute() : string
Return values
string —getCountryOptions()
public
getCountryOptions() : mixed
Return values
mixed —getStateCodeAttribute()
Mutator for "state_code" attribute.
public
getStateCodeAttribute() : string
Return values
string —getStateOptions()
public
getStateOptions() : mixed
Return values
mixed —setCountryCodeAttribute()
Sets the "country" relation with the code specified, model lookup used.
public
setCountryCodeAttribute(string $code) : mixed
Parameters
- $code : string
Return values
mixed —setCountryIdAttribute()
Ensure an integer value is set, otherwise nullable.
public
setCountryIdAttribute(mixed $value) : mixed
Parameters
- $value : mixed
Return values
mixed —setStateCodeAttribute()
Sets the "state" relation with the code specified, model lookup used.
public
setStateCodeAttribute(string $code) : mixed
Parameters
- $code : string
Return values
mixed —setStateIdAttribute()
Ensure an integer value is set, otherwise nullable.
public
setStateIdAttribute(mixed $value) : mixed
Parameters
- $value : mixed
Return values
mixed —extensionHideField()
protected
extensionHideField(mixed $name) : mixed
Parameters
- $name : mixed
Return values
mixed —extensionHideMethod()
protected
extensionHideMethod(mixed $name) : mixed
Parameters
- $name : mixed