PHP 클래스 RedBeanPHP\Repository\Frozen

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.
저자: Gabor de Mooij and the RedBeanPHP community
상속: extends RedBeanPHP\Repository
파일 보기 프로젝트 열기: gabordemooij/redbean

공개 메소드들

메소드 설명
dispense ( string $type, integer $number = 1, boolean $alwaysReturnArray = FALSE ) : RedBeanPHP\OODBBean 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.
load ( string $type, integer $id ) : RedBeanPHP\OODBBean Loads a bean from the object database.

보호된 메소드들

메소드 설명
handleException ( Exception $exception ) : void Handles exceptions.
processAdditions ( RedBeanPHP\OODBBean $bean, array $ownAdditions ) : void Part of the store() functionality.
storeBean ( RedBeanPHP\OODBBean $bean ) : void 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.

메소드 상세

dispense() 공개 메소드

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 dispense ( string $type, integer $number = 1, boolean $alwaysReturnArray = FALSE ) : RedBeanPHP\OODBBean
$type string type of bean you want to dispense
$number integer number of beans you would like to get
$alwaysReturnArray boolean if TRUE always returns the result as an array
리턴 RedBeanPHP\OODBBean

handleException() 보호된 메소드

In fluid mode, this suppresses exceptions caused by missing structures. However the implementation in frozen mode is rather the opposite, it will just re-throw every exception.
protected handleException ( Exception $exception ) : void
$exception Exception exception to handle
리턴 void

load() 공개 메소드

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.
public load ( string $type, integer $id ) : RedBeanPHP\OODBBean
$type string type of bean you want to load
$id integer ID of the bean you want to load
리턴 RedBeanPHP\OODBBean

processAdditions() 보호된 메소드

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.
protected processAdditions ( RedBeanPHP\OODBBean $bean, array $ownAdditions ) : void
$bean RedBeanPHP\OODBBean bean to process
$ownAdditions array list of addition beans in own-list
리턴 void

storeBean() 보호된 메소드

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.
protected storeBean ( RedBeanPHP\OODBBean $bean ) : void
$bean RedBeanPHP\OODBBean the clean bean
리턴 void