\RedBeanPHPSimpleModel

SimpleModel Base Model For All RedBeanPHP Models using FUSE.

RedBeanPHP FUSE is a mechanism to connect beans to posthoc models. Models are connected to beans by naming conventions. Actions on beans will result in actions on models.

Summary

Methods
Properties
Constants
loadBean()
__get()
__set()
__isset()
box()
unbox()
No public properties found
No constants found
No protected methods found
$bean
N/A
No private methods found
No private properties found
N/A

Properties

Methods

loadBean()

loadBean(\RedBeanPHP\OODBBean  $bean) : void

Used by FUSE: the ModelHelper class to connect a bean to a model.

This method loads a bean in the model.

Parameters

\RedBeanPHP\OODBBean $bean

bean to load

__get()

__get(string  $prop) : mixed

Magic Getter to make the bean properties available from the $this-scope.

Parameters

string $prop

property to get

Returns

mixed

__set()

__set(string  $prop, mixed  $value) : void

Magic Setter.

Sets the value directly as a bean property.

Parameters

string $prop

property to set value of

mixed $value

value to set

__isset()

__isset(string  $key) : boolean

Isset implementation.

Implements the isset function for array-like access.

Parameters

string $key

key to check

Returns

boolean

box()

box() : \RedBeanPHP\SimpleModel

Box the bean using the current model.

This method wraps the current bean in this model. This method can be reached using FUSE through a simple OODBBean. The method returns a RedBeanPHP Simple Model. This is useful if you would like to rely on PHP type hinting. You can box your beans before passing them to functions or methods with typed parameters.

Note about beans vs models: Use unbox to obtain the bean powering the model. If you want to use bean functionality, you should -always- unbox first. While some functionality (like magic get/set) is available in the model, this is just read-only. To use a model as a typical RedBean OODBBean you should always unbox the model to a bean. Models are meant to expose only domain logic added by the developer (business logic, no ORM logic).

Returns

\RedBeanPHP\SimpleModel

unbox()

unbox() : \RedBeanPHP\OODBBean

Unbox the bean from the model.

This method returns the bean inside the model.

Note about beans vs models: Use unbox to obtain the bean powering the model. If you want to use bean functionality, you should -always- unbox first. While some functionality (like magic get/set) is available in the model, this is just read-only. To use a model as a typical RedBean OODBBean you should always unbox the model to a bean. Models are meant to expose only domain logic added by the developer (business logic, no ORM logic).

Returns

\RedBeanPHP\OODBBean