function getAdapter($adapter)
 {
     foreach ($this->pool as $p) {
         if (\Radical\Core\CoreInterface::oneof($p, $adapter)) {
             return $p;
         }
     }
 }
Exemple #2
0
 function isValid()
 {
     if (class_exists($this->getClass())) {
         if (CoreInterface::oneof($this->getClass(), '\\Radical\\CLI\\Cron\\Jobs\\Interfaces\\ICronJob')) {
             return true;
         }
     }
     return false;
 }
Exemple #3
0
 static function fromURL(URL $url, $excluding = array())
 {
     foreach (self::$recognisers as $class) {
         $class = ltrim($class, '\\');
         if (\Radical\Core\CoreInterface::oneof($class, 'Radical\\Web\\Page\\Router\\IPageRecognise') && !in_array($class, $excluding)) {
             $r = $class::Recognise(clone $url);
             if ($r) {
                 return $r;
             }
         }
     }
 }
 function __construct($class)
 {
     if ($class instanceof ITable) {
         $class = get_class($class);
     } else {
         if (!class_exists($class)) {
             $class2 = \Radical\Core\Libraries::getProjectSpace('DB\\' . $class);
             if (class_exists($class2)) {
                 $class = $class2;
             } else {
                 throw new \Exception($class . ' class does not exist');
             }
         }
         if (!CoreInterface::oneof($class, '\\Radical\\Database\\Model\\ITable')) {
             throw new \Exception($class . ' is not a Database Table object');
         }
     }
     $this->class = $class;
 }
Exemple #5
0
 protected function call_set_value($actionPart, $value)
 {
     $hookData = array('actionPart' => $actionPart, 'value' => $value);
     $this->call_action('call_set_before', $hookData);
     if (isset($this->orm->reverseMappings[$actionPart])) {
         //Is this key a dynamic type?
         if (isset($this->orm->dynamicTyping[$actionPart])) {
             if ($value instanceof IDynamicType) {
                 //Have we been given a dynamic type?
                 $this->{$actionPart} = $value;
             } elseif (is_object($this->{$actionPart}) && $this->{$actionPart} instanceof IDynamicType) {
                 //Do we already have the key set as a dynamic type?
                 if ($value !== null || $this->{$actionPart} instanceof INullable) {
                     //can be set, set value
                     $this->{$actionPart}->setValue($value);
                 } else {
                     //Else replace (used for null)
                     $this->{$actionPart} = $value;
                 }
             } elseif ($value !== null || CoreInterface::oneof($this->orm->dynamicTyping[$actionPart]['var'], 'Radical\\Database\\DynamicTypes\\INullable')) {
                 $var = $this->orm->dynamicTyping[$actionPart]['var'];
                 $this->{$actionPart} = $var::fromUserModel($value, $this->orm->dynamicTyping[$actionPart]['extra'], $this, $actionPart);
             } else {
                 //else set to null
                 $this->{$actionPart} = null;
             }
         } else {
             $this->{$actionPart} = $value;
         }
         $this->call_action('call_set_after', $hookData);
         return $this;
     } else {
         throw new \BadMethodCallException('no field exists for set call');
     }
 }