$chillList
$chillList : array
PoolDB
Represents a pool of databases that will have persisting associations with the beans they dispense. Saving a bean from a pooled database will make sure that the bean will be stored in the database it originated from instead of the currently selected database.
$writer : \RedBeanPHP\QueryWriter
$beanhelper : \RedBeanPHP\BeanHelper|NULL
$assocManager : \RedBeanPHP\AssociationManager|NULL
$repository : \RedBeanPHP\Repository
$frozenRepository : \RedBeanPHP\Repository\Frozen|NULL
$fluidRepository : \RedBeanPHP\Repository\Fluid|NULL
$toolbox : \RedBeanPHP\ToolBox
$oodb : \RedBeanPHP\OODB
$beanHelper : \RedBeanPHP\Plugin\NonStaticBeanHelper
__construct(string $key, \RedBeanPHP\OODB $oodb)
Constructor
creates a new instance of the database pool.
string | $key | key |
\RedBeanPHP\OODB | $oodb | oodb instance |
freeze(boolean|array $toggle) : void
Toggles fluid or frozen mode. In fluid mode the database structure is adjusted to accommodate your objects. In frozen mode this is not the case.
You can also pass an array containing a selection of frozen types. Let's call this chill mode, it's just like fluid mode except that certain types (i.e. tables) aren't touched.
boolean|array | $toggle | TRUE if you want to use OODB instance in frozen mode |
isChilled(string $type) : boolean
Determines whether a type is in the chill list.
If a type is 'chilled' it's frozen, so its schema cannot be changed anymore. However other bean types may still be modified. This method is a convenience method for other objects to check if the schema of a certain type is locked for modification.
string | $type | the type you wish to check |
dispense(string $type, string $number = 1, boolean $alwaysReturnArray = FALSE) : \RedBeanPHP\OODBBean|array<mixed,\RedBeanPHP\OODBBean>
Dispenses a new bean from the database pool.
A bean that has been dispensed by the pool will have a special meta attribute called sys.source containing the key identifying the database in the pool it originated from.
string | $type | type of bean you want to dispense |
string | $number | number of beans you would like to get |
boolean | $alwaysReturnArray | if TRUE always returns the result as an array |
setBeanHelper(\RedBeanPHP\BeanHelper $beanhelper) : void
Sets bean helper to be given to beans.
Bean helpers assist beans in getting a reference to a toolbox.
\RedBeanPHP\BeanHelper | $beanhelper | helper |
getBeanHelper() : \RedBeanPHP\BeanHelper
Returns the bean helper of the database pool.
Bean helpers assist beans in getting a reference to a toolbox.
check(\RedBeanPHP\OODBBean $bean) : void
Checks whether a OODBBean bean is valid.
If the type is not valid or the ID is not valid it will throw an exception: Security.
\RedBeanPHP\OODBBean | $bean | the bean that needs to be checked |
find(string $type, array $conditions = array(), string|NULL $sql = NULL, array $bindings = array()) : array
Implements the find operation.
Conditions need to take form:
array(
'PROPERTY' => array( POSSIBLE VALUES... 'John', 'Steve' )
'PROPERTY' => array( POSSIBLE VALUES... )
);
All conditions are glued together using the AND-operator, while all value lists are glued using IN-operators thus acting as OR-conditions.
Note that you can use property names; the columns will be extracted using the appropriate bean formatter.
string | $type | type of beans you are looking for |
array | $conditions | list of conditions |
string|NULL | $sql | SQL to be used in query |
array | $bindings | a list of values to bind to query parameters |
findCollection(string $type, string|NULL $sql = NULL, array $bindings = array()) : \RedBeanPHP\BeanCollection
Same as find() but returns a BeanCollection.
string | $type | type of beans you are looking for |
string|NULL | $sql | SQL to be used in query |
array | $bindings | a list of values to bind to query parameters |
store(\RedBeanPHP\OODBBean|\RedBeanPHP\SimpleModel $bean) : integer|string
Stores the specified bean in the database in the pool it originated from by looking up the sys.source attribute.
If the database schema is not compatible with this bean and RedBean runs in frozen mode it will throw an exception. This function returns the primary key ID of the inserted bean.
The return value is an integer if possible. If it is not possible to represent the value as an integer a string will be returned. We use explicit casts instead of functions to preserve performance (0.13 vs 0.28 for 10000 iterations on Core i3).
\RedBeanPHP\OODBBean|\RedBeanPHP\SimpleModel | $bean | bean to store |
None found |
load(string $type, integer $id) : \RedBeanPHP\OODBBean
Loads a bean from the object database.
It searches for a OODBBean Bean Object in the database. It does not matter how this bean has been stored. RedBean uses the primary key ID $id and the string $type to find the bean. The $type specifies what kind of bean you are looking for; this is the same type as used with the dispense() function. If RedBean finds the bean it will return the OODB Bean object; if it cannot find the bean RedBean will return a new bean of type $type and with primary key ID 0. In the latter case it acts basically the same as dispense().
Important note: If the bean cannot be found in the database a new bean of the specified type will be generated and returned.
string | $type | type of bean you want to load |
integer | $id | ID of the bean you want to load |
None found |
trash(\RedBeanPHP\OODBBean|\RedBeanPHP\SimpleModel $bean) : integer
Removes a bean from the database.
This function will remove the specified OODBBean Bean Object from the database.
\RedBeanPHP\OODBBean|\RedBeanPHP\SimpleModel | $bean | bean you want to remove from database |
None found |
batch(string $type, array $ids) : array
Returns an array of beans. Pass a type and a series of ids and this method will bring you the corresponding beans.
important note: Because this method loads beans using the load() function (but faster) it will return empty beans with ID 0 for every bean that could not be located. The resulting beans will have the passed IDs as their keys.
string | $type | type of beans |
array | $ids | ids to load |
None found |
convertToBeans(string $type, array $rows, string $mask = NULL) : array
This is a convenience method; it converts database rows (arrays) into beans. Given a type and a set of rows this method will return an array of beans of the specified type loaded with the data fields provided by the result set from the database.
string | $type | type of beans you would like to have |
array | $rows | rows from the database result |
string | $mask | mask to apply for meta data |
None found |
count(string $type, string $addSQL = '', array $bindings = array()) : integer
Counts the number of beans of type $type.
This method accepts a second argument to modify the count-query. A third argument can be used to provide bindings for the SQL snippet.
string | $type | type of bean we are looking for |
string | $addSQL | additional SQL snippet |
array | $bindings | parameters to bind to SQL |
None found |
wipe(string $type) : boolean
Trash all beans of a given type. Wipes an entire type of bean.
string | $type | type of bean you wish to delete all instances of |
None found |
getAssociationManager() : \RedBeanPHP\AssociationManager
Returns an Association Manager for use with OODB.
A simple getter function to obtain a reference to the association manager used for storage and more.
None found |
setAssociationManager(\RedBeanPHP\AssociationManager $assocManager) : void
Sets the association manager instance to be used by this OODB.
A simple setter function to set the association manager to be used for storage and more.
\RedBeanPHP\AssociationManager | $assocManager | sets the association manager to be used |
None found |
getCurrentRepository() : \RedBeanPHP\Repository
Returns the currently used repository instance.
For testing purposes only.
None found |
None found |
bindFunc(string $mode, string $field, string|NULL $function, boolean $isTemplate = FALSE) : void
Binds an SQL function to a column.
This method can be used to setup a decode/encode scheme or perform UUID insertion. This method is especially useful for handling MySQL spatial columns, because they need to be processed first using the asText/GeomFromText functions.
string | $mode | mode to set function for, i.e. read or write |
string | $field | field (table.column) to bind SQL function to |
string|NULL | $function | SQL function to bind to field |
boolean | $isTemplate | TRUE if $function is an SQL string, FALSE for just a function name |
None found |
addEventListener(string $eventname, \RedBeanPHP\Observer $observer) : void
Implementation of the Observer Pattern.
Adds an event listener to the observable object. First argument should be the name of the event you wish to listen for. Second argument should be the object that wants to be notified in case the event occurs.
string | $eventname | event identifier |
\RedBeanPHP\Observer | $observer | observer instance |
None found |
signal(string $eventname, mixed $info) : void
Notifies listeners.
Sends the signal $eventname, the event identifier and a message object to all observers that have been registered to receive notification for this event. Part of the observer pattern implementation in RedBeanPHP.
string | $eventname | event you want signal |
mixed | $info | message object to send along |
None found |
setToolBox(\RedBeanPHP\ToolBox $toolbox) : void
Sets the toolbox to be used by the database pool.
\RedBeanPHP\ToolBox | $toolbox | toolbox |
None found |
unboxIfNeeded(\RedBeanPHP\OODBBean|\RedBeanPHP\SimpleModel $bean) : \RedBeanPHP\OODBBean
Unboxes a bean from a FUSE model if needed and checks whether the bean is an instance of OODBBean.
\RedBeanPHP\OODBBean|\RedBeanPHP\SimpleModel | $bean | bean you wish to unbox |
None found |