Exemple #1
0
 /**
  * @param array         $filters
  * @param ClassMetadata $metadata
  *
  * @return array
  */
 protected function getFieldFilters(array $filters, ClassMetadata $metadata)
 {
     $indexedFields = $this->doctrineHelper->getIndexedFields($metadata);
     foreach ($indexedFields as $fieldName => $type) {
         if (array_key_exists($fieldName, $filters)) {
             // already defined
             continue;
         }
         $filters[$fieldName] = [ConfigUtil::DATA_TYPE => $type];
     }
     return $filters;
 }
Exemple #2
0
 /**
  * @param array      $sorters
  * @param string     $entityClass
  * @param array|null $config
  *
  * @return array
  */
 protected function completeSorters(array $sorters, $entityClass, $config)
 {
     $metadata = $this->doctrineHelper->getEntityMetadataForClass($entityClass);
     $fields = array_merge(array_keys($this->doctrineHelper->getIndexedFields($metadata)), array_keys($this->doctrineHelper->getIndexedAssociations($metadata)));
     foreach ($fields as $fieldName) {
         if (array_key_exists($fieldName, $sorters)) {
             // already defined
             continue;
         }
         $sorters[$fieldName] = null;
     }
     if (!empty($config)) {
         foreach ($sorters as $fieldName => &$fieldConfig) {
             if (ConfigUtil::isExcludedField($config, $fieldName)) {
                 $fieldConfig[ConfigUtil::EXCLUDE] = true;
             }
         }
     }
     return $sorters;
 }