Example #1
0
 /**
  */
 public function getOptions()
 {
     $classSchema = $this->reflectionService->getClassSchema($this->getRelationClass());
     if ($classSchema->getRepositoryClassName() !== NULL) {
         $repository = $this->objectManager->get($classSchema->getRepositoryClassName());
         $query = call_user_func(array($repository, $this->settings['QueryMethod']));
     } else {
         $query = $this->persistenceManager->createQueryForType($this->getRelationClass());
     }
     $options = $query->execute()->toArray();
     if ($this->settings['LabelPath'] !== NULL) {
         $options = array();
         foreach ($query->execute() as $option) {
             $identifier = $this->persistenceManager->getIdentifierByObject($option);
             $label = ObjectAccess::getPropertyPath($option, $this->settings['LabelPath']);
             $options[$identifier] = $label;
         }
     }
     if ($this->settings['EmptyOption'] !== NULL) {
         $newOptions = array('' => $this->settings['EmptyOption']);
         foreach ($options as $key => $value) {
             $newOptions[$key] = $value;
         }
         $options = $newOptions;
     }
     return $options;
 }
 /**
  * Get the current property of the object bound to this form.
  *
  * @return mixed Value
  */
 protected function getPropertyValue()
 {
     if (!$this->viewHelperVariableContainer->exists('TYPO3\\Fluid\\ViewHelpers\\FormViewHelper', 'formObject')) {
         return null;
     }
     $formObject = $this->viewHelperVariableContainer->get('TYPO3\\Fluid\\ViewHelpers\\FormViewHelper', 'formObject');
     $propertyNameOrPath = $this->arguments['property'];
     return ObjectAccess::getPropertyPath($formObject, $propertyNameOrPath);
 }