Exemplo n.º 1
0
 protected function constructDerived($bean, $setDefaults)
 {
     assert('$bean === null || $bean instanceof RedBean_OODBBean');
     assert('is_bool($setDefaults)');
     parent::constructDerived($bean, $setDefaults);
     $this->setSpecialGroup();
 }
Exemplo n.º 2
0
 /**
  * @param RedBean_OODBBean $bean
  * @param bool $setDefaults
  */
 protected function constructDerived($bean, $setDefaults)
 {
     assert('$bean === null || $bean instanceof RedBean_OODBBean');
     assert('is_bool($setDefaults)');
     // Does a subset of what RedBeanModel::__construct does
     // in order to mix in the Person - this is metadata wise,
     // User doesn't get any functionality from Person.
     $modelClassName = 'Person';
     $tableName = $modelClassName::getTableName();
     if ($bean === null) {
         $personBean = ZurmoRedBean::dispense($tableName);
     } else {
         $userBean = $this->getClassBean('User');
         $personBean = ZurmoRedBeanLinkManager::getBean($userBean, $tableName);
         assert('$personBean !== null');
     }
     //This is a hack to recover from a bug we cannot figure out how to solve.
     //Rarely the person attributes are not part of the user, memcache needs to be restarted to solve this
     //problem as you can't use the system once this occurs. this check below will clear the specific cache
     //that causes this. Still need to figure out what is setting the cache wrong to begin with
     if (!static::isAnAttribute('lastName')) {
         static::forgetBeanModel('User');
     }
     $this->setClassBean($modelClassName, $personBean);
     $this->mapAndCacheMetadataAndSetHints($modelClassName, $personBean);
     parent::constructDerived($bean, $setDefaults);
 }
Exemplo n.º 3
0
 /**
  * @param RedBean_OODBBean $bean
  * @param bool $setDefaults
  */
 protected function constructDerived($bean, $setDefaults)
 {
     assert('$bean === null || $bean instanceof RedBean_OODBBean');
     assert('is_bool($setDefaults)');
     // Does a subset of what RedBeanModel::__construct does
     // in order to mix in the Person - this is metadata wise,
     // User doesn't get any functionality from Person.
     $modelClassName = 'Person';
     $tableName = self::getTableName($modelClassName);
     if ($bean === null) {
         $personBean = R::dispense($tableName);
     } else {
         $userBean = $this->getClassBean('User');
         $personBean = ZurmoRedBeanLinkManager::getBean($userBean, $tableName);
         assert('$personBean !== null');
     }
     $this->setClassBean($modelClassName, $personBean);
     $this->mapAndCacheMetadataAndSetHints($modelClassName, $personBean);
     parent::constructDerived($bean, $setDefaults);
 }