Overview

Namespaces

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

Classes

  • ArrayTool
  • DispenseHelper
  • Dump
  • MultiLoader
  • Transaction
  • Overview
  • Namespace
  • Class

Class DispenseHelper

Dispense Helper

A helper class containing a dispense utility.

Namespace: RedBeanPHP\Util
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/Util/DispenseHelper.php
Located at Util/DispenseHelper.php
Methods summary
public static array|OODBBean
# dispense( RedBeanPHP\OODB $oodb, string|array $typeOrBeanArray, integer $num = 1, boolean $alwaysReturnArray = FALSE )

Dispenses a new RedBean OODB Bean for use with the rest of the methods.

Dispenses a new RedBean OODB Bean for use with the rest of the methods.

Parameters

$oodb
OODB
$typeOrBeanArray
type or bean array to import
$num
$number number of beans to dispense
$alwaysReturnArray
if TRUE always returns the result as an array

Returns

array|OODBBean
public static array
# dispenseAll( RedBeanPHP\OODB $oodb, string $order, boolean $onlyArrays = FALSE )

Takes a comma separated list of bean types and dispenses these beans. For each type in the list you can specify the number of beans to be dispensed.

Takes a comma separated list of bean types and dispenses these beans. For each type in the list you can specify the number of beans to be dispensed.

Usage:

list( $book, $page, $text ) = R::dispenseAll( 'book,page,text' );

This will dispense a book, a page and a text. This way you can quickly dispense beans of various types in just one line of code.

Usage:

list($book, $pages) = R::dispenseAll('book,page*100');

This returns an array with a book bean and then another array containing 100 page beans.

Parameters

$oodb
OODB
$order
a description of the desired dispense order using the syntax above
$onlyArrays
return only arrays even if amount < 2

Returns

array
API documentation generated by ApiGen