Overview

Namespaces

  • None
  • RedBeanPHP
    • Adapter
    • BeanHelper
    • Cursor
    • Driver
    • Logger
      • RDefault
    • QueryWriter
    • RedException
    • Repository
    • Util

Classes

  • Fluid
  • Frozen
  • Overview
  • Namespace
  • Class

Class Fluid

Fluid Repository. OODB manages two repositories, a fluid one that adjust the database schema on-the-fly to accomodate for new bean types (tables) and new properties (columns) and a frozen one for use in a production environment. OODB allows you to swap the repository instances using the freeze() method.

RedBeanPHP\Repository
Extended by RedBeanPHP\Repository\Fluid
Namespace: RedBeanPHP\Repository
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/Repository/Fluid.php
Located at Repository/Fluid.php
Methods summary
protected
# processAdditions( RedBeanPHP\OODBBean $bean, array $ownAdditions )

Part of the store() functionality. Handles all new additions after the bean has been saved. Stores addition bean in own-list, extracts the id and adds a foreign key. Also adds a constraint in case the type is in the dependent list.

Part of the store() functionality. Handles all new additions after the bean has been saved. Stores addition bean in own-list, extracts the id and adds a foreign key. Also adds a constraint in case the type is in the dependent list.

Note that this method raises a custom exception if the bean is not an instance of OODBBean. Therefore it does not use a type hint. This allows the user to take action in case invalid objects are passed in the list.

Parameters

$bean
bean to process
$ownAdditions
list of addition beans in own-list
protected
# storeBean( RedBeanPHP\OODBBean $bean )

Stores a cleaned bean; i.e. only scalar values. This is the core of the store() method. When all lists and embedded beans (parent objects) have been processed and removed from the original bean the bean is passed to this method to be stored in the database.

Stores a cleaned bean; i.e. only scalar values. This is the core of the store() method. When all lists and embedded beans (parent objects) have been processed and removed from the original bean the bean is passed to this method to be stored in the database.

Parameters

$bean
the clean bean
protected
# handleException( Exception $exception )

Handles exceptions. Suppresses exceptions caused by missing structures.

Handles exceptions. Suppresses exceptions caused by missing structures.

Parameters

$exception
exception
public RedBeanPHP\OODBBean
# 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.

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.

Parameters

$type
type of bean you want to dispense
$number
number of beans you would like to get
$alwaysReturnArray
if TRUE always returns the result as an array

Returns

RedBeanPHP\OODBBean
public RedBeanPHP\OODBBean
# 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().

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.

Parameters

$type
type of bean you want to load
$id
ID of the bean you want to load

Returns

RedBeanPHP\OODBBean
Methods inherited from RedBeanPHP\Repository
__construct(), batch(), check(), convertToBeans(), count(), find(), findCollection(), hasListsOrObjects(), prepareEmbeddedBean(), processEmbeddedBean(), processGroups(), processResidue(), processSharedAdditions(), processSharedResidue(), processSharedTrashcan(), processTrashcan(), store(), storeBeanWithLists(), tableExists(), trash(), wipe()
Properties inherited from RedBeanPHP\Repository
$nesting, $stash, $writer
API documentation generated by ApiGen