Class OODB
RedBean Object Oriented DataBase.
The RedBean OODB Class is the main class of RedBeanPHP. It takes OODBBean objects and stores them to and loads them from the database as well as providing other CRUD functions. This class acts as a object database.
- RedBeanPHP\Observable
- RedBeanPHP\OODB
Copyright:
copyright (c) G.J.G.T. (Gabor) de Mooij and the RedBeanPHP Community This source file is subject to the BSD/GPLv2 License that is bundled with this source code in the file license.txt.
License: BSD/GPLv2
Author: Gabor de Mooij and the RedBeanPHP community
File: RedBeanPHP/OODB.php
Located at OODB.php
public static
|
#
autoClearHistoryAfterStore( boolean $autoClear = TRUE )
If set to TRUE, this method will call clearHistory every time the bean gets stored. |
protected
|
#
unboxIfNeeded(
Unboxes a bean from a FUSE model if needed and checks whether the bean is an instance of OODBBean. |
public
|
#
__construct(
Constructor, requires a query writer. |
public
|
|
public
boolean
|
|
public
boolean
|
#
isChilled( string $type )
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. |
public
|
#
dispense( string $type, string $number = 1, boolean $alwaysReturnArray = FALSE )
Dispenses a new bean (a OODBBean Bean Object) of the specified type. Always use this function to get an empty bean object. Never instantiate a OODBBean yourself because it needs to be configured before you can use it with RedBean. This function applies the appropriate initialization / configuration for you. |
public
|
#
setBeanHelper(
Sets bean helper to be given to beans. Bean helpers assist beans in getting a reference to a toolbox. |
public
|
#
getBeanHelper( )
Returns the current bean helper. Bean helpers assist beans in getting a reference to a toolbox. |
public
|
#
check(
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. |
public
array
|
|
public
array
|
#
findCollection( string $type, string $sql = NULL, array $bindings = array() )
Same as find() but returns a BeanCollection. |
public
boolean
|
#
tableExists( string $table )
Checks whether the specified table already exists in the database. Not part of the Object Database interface! |
public
integer|string
|
#
store(
Stores a bean in the database. This method takes a OODBBean Bean Object $bean and stores it in the database. If the database schema is not compatible with this bean and RedBean runs in fluid mode the schema will be altered to store the bean correctly. 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. |
public
|
#
load( string $type, integer $id )
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(). |
public
|
#
trash(
Removes a bean from the database. This function will remove the specified OODBBean Bean Object from the database. |
public
array
|
|
public
array
|
#
convertToBeans( string $type, array $rows, string $mask = NULL )
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. |
public
integer
|
|
public
boolean
|
|
public
|
#
getAssociationManager( )
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. |
public
|
#
setAssociationManager(
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. |
public
|
#
getCurrentRepository( )
Returns the currently used repository instance. For testing purposes only. |
public
|
#
bindFunc( string $mode, string $field, string $function )
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. |
addEventListener(),
signal()
|
protected
array
|
$chillList
|
#
array()
|
protected
array
|
$stash
|
#
NULL
|
protected
integer
|
$nesting
|
#
0
|
protected
|
$writer
|
|
protected
boolean
|
$isFrozen
|
#
FALSE
|
protected
FacadeBeanHelper
|
$beanhelper
|
#
NULL
|
protected
|
$assocManager
|
#
NULL
|
protected
|
$repository
|
#
NULL
|
protected
|
$frozenRepository
|
#
NULL
|
protected
|
$fluidRepository
|
#
NULL
|
protected static
boolean
|
$autoClearHistoryAfterStore
|
#
FALSE
|