RedBeanPHP\ToolBox::getRedBean PHP Method

getRedBean() public method

OODB is responsible for creating, storing, retrieving and deleting single beans. Other components rely on OODB for their basic functionality.
public getRedBean ( ) : RedBeanPHP\OODB
return RedBeanPHP\OODB
    public function getRedBean()
    {
        return $this->oodb;
    }

Usage Example

Example #1
0
 /**
  * Returns a label or an array of labels for use as ENUMs.
  * 
  * @param string $enum ENUM specification for label
  * 
  * @return array|OODBBean
  */
 public function enum($enum)
 {
     $oodb = $this->toolbox->getRedBean();
     if (strpos($enum, ':') === FALSE) {
         $type = $enum;
         $value = FALSE;
     } else {
         list($type, $value) = explode(':', $enum);
         $value = preg_replace('/\\W+/', '_', strtoupper(trim($value)));
     }
     $values = $oodb->find($type);
     if ($value === FALSE) {
         return $values;
     }
     foreach ($values as $enumItem) {
         if ($enumItem->name === $value) {
             return $enumItem;
         }
     }
     $newEnumItems = $this->dispenseLabels($type, array($value));
     $newEnumItem = reset($newEnumItems);
     $oodb->store($newEnumItem);
     return $newEnumItem;
 }
All Usage Examples Of RedBeanPHP\ToolBox::getRedBean