Example #1
0
 public static function callMethod($object, $methodName, $argValues)
 {
     $method = new ReflectionMethod(get_class($object), $methodName);
     $result = $method->invokeArgs($object, $argValues);
     BeanLocator::storeBean($object);
     return $result;
 }
Example #2
0
 public function __construct()
 {
     $this->db = Singleton::create("DatabaseManager");
     if (is_null(self::$dbCache)) {
         self::$dbCache = BeanLocator::get("DatabaseCache");
     }
 }
Example #3
0
 public function execute($actionParams)
 {
     $action = $this->expression;
     list($beanClass, $methodName) = BeanUtil::getBeanAndProperties($action);
     $beanInstance = BeanLocator::get($beanClass);
     return ReflectionUtil::callMethod($beanInstance, $methodName, $actionParams);
 }
Example #4
0
 public function resetSingle($entity, $id)
 {
     if (!$this->enabled) {
         return;
     }
     unset($this->cache[$entity][self::SINGLE][$id]);
     BeanLocator::storeBean($this);
 }
Example #5
0
 private function updateModel(MovicoRequest $req)
 {
     $vars = $req->getPostVars();
     foreach ($vars as $var) {
         list($beanClass, $nestedProperty) = BeanUtil::getBeanAndProperties($var->getName(), true);
         ReflectionUtil::callNestedSetter(BeanLocator::get($beanClass), $nestedProperty, $var->getConvertedValue());
     }
     $files = $req->getFiles();
     foreach ($files as $key => $fileArray) {
         $file = new UploadedFile($fileArray);
         list($beanClass, $nestedProperty) = BeanUtil::getBeanAndProperties($key, true);
         ReflectionUtil::callNestedSetter(BeanLocator::get($beanClass), $nestedProperty, $file);
     }
 }
Example #6
0
 private function getViewCache()
 {
     return BeanLocator::get("ViewCache")->getCache();
 }
Example #7
0
 private function getBeanValue($valueExpression, $rowIndex = null)
 {
     list($beanClass, $nestedProperty) = BeanUtil::getBeanAndProperties($valueExpression);
     try {
         $beanObj = BeanLocator::get($beanClass);
     } catch (NoSuchBeanException $e) {
         try {
             $dataSeries = $this->getFirstAncestorOfType("DataSeries");
             if ($dataSeries->getVar() !== $beanClass || is_null($rowIndex)) {
                 throw new NoSuchBeanException($beanClass);
             }
             $rows = $dataSeries->getRows();
             $beanObj = $rows[$rowIndex];
         } catch (NoSuchAnchestorComponentException $e) {
             throw new NoSuchBeanException($beanClass);
         }
     }
     return ReflectionUtil::callNestedGetter($beanObj, $nestedProperty);
 }
Example #8
0
 public function getRows()
 {
     list($beanClass, $nestedProperty) = BeanUtil::getBeanAndProperties($this->value);
     $beanObj = BeanLocator::get($beanClass);
     return ReflectionUtil::callNestedGetter($beanObj, $nestedProperty);
 }