PHP 클래스 FOF30\Model\Model

A generic MVC model implementation
파일 보기 프로젝트 열기: akeeba/fof 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_ignoreRequest boolean Should we ignore request data when trying to get state data not already set in the Model?
$_savestate boolean Should I save the model's state in the session?
$_state_set boolean Are the state variables already set?
$container FOF30\Container\Container The container attached to the model
$name string The model (base) name
$state string A state object

공개 메소드들

메소드 설명
__call ( string $name, mixed $arguments ) : static Magic caller; allows to use the name of model state keys as methods to set their values.
__construct ( Container $container, array $config = [] ) Public class constructor
__get ( string $name ) : static Magic getter; allows to use the name of model state keys as properties. Also handles magic properties: $this->input mapped to $this->container->input
__set ( string $name, mixed $value ) : static Magic setter; allows to use the name of model state keys as properties
clearState ( ) : static Clears the model state, but doesn't touch the internal lists of records, record tables or record id variables. To clear these values, please use reset().
getClone ( ) Clones the model object and returns the clone
getContainer ( ) : Container Returns a reference to the model's container
getHash ( ) : string Returns a unique hash for each view, used to prefix the state variables to allow us to retrieve them from the state later on.
getIgnoreRequest ( ) : boolean Gets the ignore request flag. When false, getState() will try to populate state variables not already set from same-named state variables in the request.
getName ( ) : string Method to get the model name
getState ( string $key = null, mixed $default = null, string $filter_type = 'raw' ) : mixed Get a filtered state variable
populateSavestate ( ) : static Public setter for the _savestate variable. Set it to true to save the state of the Model in the session.
savestate ( boolean $newState ) : static Sets the model state auto-save status. By default the model is set up to save its state to the session.
setIgnoreRequest ( boolean $ignoreRequest ) Sets the ignore request flag. When false, getState() will try to populate state variables not already set from same-named state variables in the request.
setState ( string $property, mixed $value = null ) : mixed Method to set model state variables
tmpInstance ( ) Returns a temporary instance of the model. Please note that this returns a _clone_ of the model object, not the original object. The new object is set up to not save its stats, ignore the request when getting state variables and comes with an empty state.

보호된 메소드들

메소드 설명
populateState ( ) : void Method to auto-populate the model state.
triggerEvent ( string $event, array $arguments = [] ) : void Triggers an object-specific event. The event runs both locally –if a suitable method exists– and through the object's behaviours dispatcher and Joomla! plugin system. Neither handler is expected to return anything (return values are ignored). If you want to mark an error and cancel the event you have to raise an exception.

비공개 메소드들

메소드 설명
internal_getState ( string $property = null, mixed $default = null ) : object Method to get model state variables

메소드 상세

__call() 공개 메소드

Magic caller; allows to use the name of model state keys as methods to set their values.
public __call ( string $name, mixed $arguments ) : static
$name string The state variable key
$arguments mixed The state variable contents
리턴 static

__construct() 공개 메소드

You can use the $config array to pass some configuration values to the object: state stdClass|array. The state variables of the Model. use_populate Boolean. When true the model will set its state from populateState() instead of the request. ignore_request Boolean. When true getState will not automatically load state data from the request.
public __construct ( Container $container, array $config = [] )
$container FOF30\Container\Container The configuration variables to this model
$config array Configuration values for this model

__get() 공개 메소드

Magic getter; allows to use the name of model state keys as properties. Also handles magic properties: $this->input mapped to $this->container->input
public __get ( string $name ) : static
$name string The state variable key
리턴 static

__set() 공개 메소드

Magic setter; allows to use the name of model state keys as properties
public __set ( string $name, mixed $value ) : static
$name string The state variable key
$value mixed The state variable value
리턴 static

clearState() 공개 메소드

Clears the model state, but doesn't touch the internal lists of records, record tables or record id variables. To clear these values, please use reset().
public clearState ( ) : static
리턴 static

getClone() 공개 메소드

Clones the model object and returns the clone
public getClone ( )

getContainer() 공개 메소드

Returns a reference to the model's container
public getContainer ( ) : Container
리턴 FOF30\Container\Container

getHash() 공개 메소드

Returns a unique hash for each view, used to prefix the state variables to allow us to retrieve them from the state later on.
public getHash ( ) : string
리턴 string

getIgnoreRequest() 공개 메소드

Gets the ignore request flag. When false, getState() will try to populate state variables not already set from same-named state variables in the request.
public getIgnoreRequest ( ) : boolean
리턴 boolean

getName() 공개 메소드

The model name. By default parsed using the classname or it can be set by passing a $config['name'] in the class constructor
public getName ( ) : string
리턴 string The name of the model

getState() 공개 메소드

Get a filtered state variable
public getState ( string $key = null, mixed $default = null, string $filter_type = 'raw' ) : mixed
$key string The state variable's name
$default mixed The default value to return if it's not already set
$filter_type string The filter type to use
리턴 mixed The state variable's contents

populateSavestate() 공개 메소드

Public setter for the _savestate variable. Set it to true to save the state of the Model in the session.
public populateSavestate ( ) : static
리턴 static

populateState() 보호된 메소드

This method should only be called once per instantiation and is designed to be called on the first call to the getState() method unless the model configuration flag to ignore the request is set.
protected populateState ( ) : void
리턴 void

savestate() 공개 메소드

Sets the model state auto-save status. By default the model is set up to save its state to the session.
public savestate ( boolean $newState ) : static
$newState boolean True to save the state, false to not save it.
리턴 static

setIgnoreRequest() 공개 메소드

Sets the ignore request flag. When false, getState() will try to populate state variables not already set from same-named state variables in the request.
public setIgnoreRequest ( boolean $ignoreRequest )
$ignoreRequest boolean

setState() 공개 메소드

Method to set model state variables
public setState ( string $property, mixed $value = null ) : mixed
$property string The name of the property.
$value mixed The value of the property to set or null.
리턴 mixed The previous value of the property or null if not set.

tmpInstance() 공개 메소드

Returns a temporary instance of the model. Please note that this returns a _clone_ of the model object, not the original object. The new object is set up to not save its stats, ignore the request when getting state variables and comes with an empty state.
public tmpInstance ( )

triggerEvent() 보호된 메소드

EXAMPLE Component: com_foobar, Object name: item, Event: onBeforeSomething, Arguments: array(123, 456) The event calls: 1. $this->onBeforeSomething(123, 456) 2. $his->behavioursDispatcher->trigger('onBeforeSomething', array(&$this, 123, 456)) 3. Joomla! plugin event onComFoobarModelItemBeforeSomething($this, 123, 456)
protected triggerEvent ( string $event, array $arguments = [] ) : void
$event string The name of the event, typically named onPredicateVerb e.g. onBeforeKick
$arguments array The arguments to pass to the event handlers
리턴 void

프로퍼티 상세

$_ignoreRequest 보호되어 있는 프로퍼티

Should we ignore request data when trying to get state data not already set in the Model?
protected bool $_ignoreRequest
리턴 boolean

$_savestate 보호되어 있는 프로퍼티

Should I save the model's state in the session?
protected bool $_savestate
리턴 boolean

$_state_set 보호되어 있는 프로퍼티

Are the state variables already set?
protected bool $_state_set
리턴 boolean

$container 보호되어 있는 프로퍼티

The container attached to the model
protected Container,FOF30\Container $container
리턴 FOF30\Container\Container

$name 보호되어 있는 프로퍼티

The model (base) name
protected string $name
리턴 string

$state 보호되어 있는 프로퍼티

A state object
protected string $state
리턴 string