getExtractedToolbox() public method

This method returns a list with all toolbox items in Toolbox Constructor order: OODB, adapter, writer and finally the toolbox itself!.
public getExtractedToolbox ( ) : array
return array
Ejemplo n.º 1
0
 /**
  * Magic Setter. Sets the value for a specific property.
  * This setter acts as a hook for OODB to mark beans as tainted.
  * The tainted meta property can be retrieved using getMeta("tainted").
  * The tainted meta property indicates whether a bean has been modified and
  * can be used in various caching mechanisms.
  *
  * @param string $property name of the property you wish to assign a value to
  * @param  mixed $value    the value you want to assign
  *
  * @return void
  */
 public function __set($property, $value)
 {
     $isEx = FALSE;
     $isOwn = FALSE;
     $isShared = FALSE;
     if (!ctype_lower($property)) {
         $property = $this->beau($property);
         if (strpos($property, 'xown') === 0 && ctype_upper(substr($property, 4, 1))) {
             $property = substr($property, 1);
             $listName = lcfirst(substr($property, 3));
             $isEx = TRUE;
             $isOwn = TRUE;
             $this->__info['sys.exclusive-' . $listName] = TRUE;
         } elseif (strpos($property, 'own') === 0 && ctype_upper(substr($property, 3, 1))) {
             $isOwn = TRUE;
             $listName = lcfirst(substr($property, 3));
         } elseif (strpos($property, 'shared') === 0 && ctype_upper(substr($property, 6, 1))) {
             $isShared = TRUE;
         }
     }
     $hasAlias = !is_null($this->aliasName);
     $differentAlias = $hasAlias && $isOwn && isset($this->__info['sys.alias.' . $listName]) ? $this->__info['sys.alias.' . $listName] !== $this->aliasName : FALSE;
     $hasSQL = $this->withSql !== '' || $this->via !== NULL;
     $exists = isset($this->properties[$property]);
     $fieldLink = $property . '_id';
     if (($isOwn || $isShared) && (!$exists || $hasSQL || $differentAlias)) {
         if (!$this->noLoad) {
             list($redbean, , , $toolbox) = $this->beanHelper->getExtractedToolbox();
             if ($isOwn) {
                 $beans = $this->getOwnList($listName, $redbean);
             } else {
                 $beans = $this->getSharedList(lcfirst(substr($property, 6)), $redbean, $toolbox);
             }
             $this->__info["sys.shadow.{$property}"] = $beans;
         }
     }
     $this->withSql = '';
     $this->withParams = array();
     $this->aliasName = NULL;
     $this->fetchType = NULL;
     $this->noLoad = FALSE;
     $this->all = FALSE;
     $this->via = NULL;
     $this->__info['tainted'] = TRUE;
     $this->__info['changed'] = TRUE;
     if (array_key_exists($fieldLink, $this->properties) && !$value instanceof OODBBean) {
         if (is_null($value) || $value === FALSE) {
             unset($this->properties[$property]);
             $this->properties[$fieldLink] = NULL;
             return;
         } else {
             throw new RedException('Cannot cast to bean.');
         }
     }
     if ($value === FALSE) {
         $value = '0';
     } elseif ($value === TRUE) {
         $value = '1';
     } elseif ($value instanceof \DateTime) {
         $value = $value->format('Y-m-d H:i:s');
     }
     $this->properties[$property] = $value;
 }