Esempio n. 1
0
 /**
  * @param array      $filters
  * @param string     $entityClass
  * @param array|null $config
  *
  * @return array
  */
 protected function completeFilters(array $filters, $entityClass, $config)
 {
     $metadata = $this->doctrineHelper->getEntityMetadataForClass($entityClass);
     $filters = $this->getFieldFilters($filters, $metadata);
     $filters = $this->getAssociationFilters($filters, $metadata);
     if (!empty($config)) {
         foreach ($filters as $fieldName => &$fieldConfig) {
             if (ConfigUtil::isExcludedField($config, $fieldName)) {
                 $fieldConfig[ConfigUtil::EXCLUDE] = true;
             }
         }
     }
     return $filters;
 }
Esempio n. 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;
 }