コード例 #1
0
ファイル: ArrayUtil.php プロジェクト: aeberh/php-movico
 public static function toIndexedArray($objects, $key, $value = null)
 {
     self::checkTypes($objects);
     if (is_null($value)) {
         $value = $key;
     }
     StringUtil::checkTypes($key, $value);
     if (empty($objects)) {
         return array();
     }
     $result = array();
     foreach ($objects as $object) {
         $keyString = ReflectionUtil::callNestedGetter($object, $key);
         $valueString = ReflectionUtil::callNestedGetter($object, $value);
         $result[$keyString] = $valueString;
     }
     return $result;
 }
コード例 #2
0
ファイル: Component.php プロジェクト: aeberh/php-movico
 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);
 }
コード例 #3
0
ファイル: DataTable.php プロジェクト: aeberh/php-movico
 public function getRows()
 {
     list($beanClass, $nestedProperty) = BeanUtil::getBeanAndProperties($this->value);
     $beanObj = BeanLocator::get($beanClass);
     return ReflectionUtil::callNestedGetter($beanObj, $nestedProperty);
 }