/** * {@inheritdoc} */ public function process(ContextInterface $context) { /** @var ConfigContext $context */ if ($context->hasSorters()) { // a sorters' definition is already built return; } $context->setSorters(ConfigUtil::getInitialConfig()); }
/** * {@inheritdoc} */ public function process(ContextInterface $context) { /** @var ConfigContext $context */ $sorters = $context->getSorters(); if (null === $sorters) { // a sorters' configuration does not exist return; } $entityClass = $context->getClassName(); if (!$this->doctrineHelper->isManageableEntityClass($entityClass)) { // only manageable entities are supported return; } $context->setSorters($this->removeDuplicates($sorters, $entityClass)); }
/** * {@inheritdoc} */ public function process(ContextInterface $context) { /** @var ConfigContext $context */ $sorters = $context->getSorters(); if (null === $sorters) { // a sorters' configuration does not exist return; } $definition = $context->getResult(); if (null === $definition) { // an entity configuration does not exist return; } $this->collect($sorters, ConfigUtil::SORTERS, $definition); $context->setSorters($sorters); }
/** * {@inheritdoc} */ public function process(ContextInterface $context) { /** @var ConfigContext $context */ $sorters = $context->getSorters(); if (empty($sorters)) { // nothing to normalize return; } $fields = ConfigUtil::getArrayValue($sorters, ConfigUtil::FIELDS); if (ConfigUtil::isExcludeAll($sorters)) { $fields = ConfigUtil::removeExclusions($sorters); } else { $entityClass = $context->getClassName(); if ($this->doctrineHelper->isManageableEntityClass($entityClass)) { $fields = ConfigUtil::removeExclusions($this->completeSorters($fields, $entityClass, $context->getResult())); } } $context->setSorters([ConfigUtil::EXCLUSION_POLICY => ConfigUtil::EXCLUSION_POLICY_ALL, ConfigUtil::FIELDS => $fields]); }