/**
  * {@inheritdoc}
  */
 public function addField($name, $value, $presentation = null)
 {
     $field = $this->fieldRepository->findOneBy(array('name' => $name));
     if (null === $field) {
         $field = $this->fieldRepository->createNew();
         $field->setName($name);
         $field->setPresentation($presentation ?: $name);
         $this->manager->persist($field);
         $this->manager->flush($field);
     }
     $fieldValue = $this->fieldValueRepository->createNew();
     $fieldValue->setField($field);
     // TODO: Value is not currently supported.
     $this->resource->addField($fieldValue);
     return $this;
 }
Пример #2
0
 /**
  * Load parameter from database.
  *
  * @param string $namespace
  *
  * @return array
  */
 private function getParameters($namespace)
 {
     $parameters = array();
     foreach ($this->parameterRepository->findBy(array('namespace' => $namespace)) as $parameter) {
         $parameters[$parameter->getName()] = $parameter->getValue();
     }
     return $parameters;
 }
 /**
  * Get query builder for a target.
  *
  * @return QueryBuilder
  */
 private function getTargetQueryBuilder()
 {
     return $this->repository->getQueryBuilder();
 }