From 2cd36855d194874163f30e7eb2c80b5685a3d646 Mon Sep 17 00:00:00 2001 From: Tom H Anderson Date: Tue, 3 Jul 2018 16:42:31 -0600 Subject: [PATCH] Renamed all Criteria objects to Criteria from Filter --- src/ConfigProvider.php | 4 ++-- .../{FilterManager.php => CriteriaManager.php} | 2 +- src/Criteria/CriteriaManagerFactory.php | 10 ++++++++++ src/Criteria/{FilterType.php => CriteriaType.php} | 2 +- ...ractFactory.php => CriteriaTypeAbstractFactory.php} | 10 +++++----- src/Criteria/FilterManagerFactory.php | 10 ---------- src/Module.php | 2 +- src/Type/EntityTypeAbstractFactory.php | 4 ++-- 8 files changed, 22 insertions(+), 22 deletions(-) rename src/Criteria/{FilterManager.php => CriteriaManager.php} (96%) create mode 100644 src/Criteria/CriteriaManagerFactory.php rename src/Criteria/{FilterType.php => CriteriaType.php} (69%) rename src/Criteria/{FilterTypeAbstractFactory.php => CriteriaTypeAbstractFactory.php} (97%) delete mode 100644 src/Criteria/FilterManagerFactory.php diff --git a/src/ConfigProvider.php b/src/ConfigProvider.php index d570800..7bcd48c 100644 --- a/src/ConfigProvider.php +++ b/src/ConfigProvider.php @@ -47,7 +47,7 @@ public function getDependencyConfig() Hydrator\Strategy\AssociationDefault::class => InvokableFactory::class, Hydrator\Strategy\FieldDefault::class => InvokableFactory::class, - Criteria\FilterManager::class => Criteria\FilterManagerFactory::class, + Criteria\CriteriaManager::class => Criteria\CriteriaManagerFactory::class, Field\FieldResolver::class => Field\FieldResolverFactory::class, Filter\Loader::class => Filter\LoaderFactory::class, Filter\FilterManager::class => Filter\FilterManagerFactory::class, @@ -96,7 +96,7 @@ public function getDoctrineGraphQLCriteriaConfig() { return [ 'abstract_factories' => [ - Criteria\FilterTypeAbstractFactory::class, + Criteria\CriteriaTypeAbstractFactory::class, ], ]; } diff --git a/src/Criteria/FilterManager.php b/src/Criteria/CriteriaManager.php similarity index 96% rename from src/Criteria/FilterManager.php rename to src/Criteria/CriteriaManager.php index 957bab3..dc8af2b 100644 --- a/src/Criteria/FilterManager.php +++ b/src/Criteria/CriteriaManager.php @@ -6,7 +6,7 @@ use Zend\ServiceManager\Exception; use GraphQL\Type\Definition\Type; -class FilterManager extends AbstractPluginManager +class CriteriaManager extends AbstractPluginManager { /** * @var string diff --git a/src/Criteria/CriteriaManagerFactory.php b/src/Criteria/CriteriaManagerFactory.php new file mode 100644 index 0000000..fd72f06 --- /dev/null +++ b/src/Criteria/CriteriaManagerFactory.php @@ -0,0 +1,10 @@ +isCached($requestedName, $options)) { @@ -187,7 +187,7 @@ public function __invoke(ContainerInterface $container, $requestedName, array $o $fields[$fieldName . '_between'] = [ 'name' => $fieldName . '_between', 'description' => 'Filter between `from` and `to` values. Good substitute for DateTime Equals.', - 'type' => new FilterTypeNS\Between(['fields' => [ + 'type' => new CriteriaTypeNS\Between(['fields' => [ 'from' => [ 'name' => 'from', 'type' => Type::nonNull($graphQLType), @@ -272,7 +272,7 @@ public function __invoke(ContainerInterface $container, $requestedName, array $o 'documentation' => 'Limit the number of results to x.', ]; - $instance = new FilterType([ + $instance = new CriteriaType([ 'name' => str_replace('\\', '_', $requestedName) . '__CriteriaFilter', 'fields' => function () use ($fields) { return $fields; diff --git a/src/Criteria/FilterManagerFactory.php b/src/Criteria/FilterManagerFactory.php deleted file mode 100644 index 2655e4f..0000000 --- a/src/Criteria/FilterManagerFactory.php +++ /dev/null @@ -1,10 +0,0 @@ -addServiceManager( - Criteria\FilterManager::class, + Criteria\CriteriaManager::class, 'zf-doctrine-graphql-criteria', InputObjectType::class, 'getZFDoctrineGraphQLCriteriaConfig' diff --git a/src/Type/EntityTypeAbstractFactory.php b/src/Type/EntityTypeAbstractFactory.php index 135883c..52e0a77 100644 --- a/src/Type/EntityTypeAbstractFactory.php +++ b/src/Type/EntityTypeAbstractFactory.php @@ -15,7 +15,7 @@ use GraphQL\Type\Definition\ResolveInfo; use ZF\Doctrine\Criteria\Builder as CriteriaBuilder; use ZF\Doctrine\GraphQL\AbstractAbstractFactory; -use ZF\Doctrine\GraphQL\Criteria\FilterManager; +use ZF\Doctrine\GraphQL\Criteria\CriteriaManager; use ZF\Doctrine\GraphQL\Field\FieldResolver; use ZF\Doctrine\GraphQL\Event; @@ -68,7 +68,7 @@ public function __invoke(ContainerInterface $container, $requestedName, array $o $config = $container->get('config'); $fieldResolver = $container->get(FieldResolver::class); $typeManager = $container->get(TypeManager::class); - $criteriaFilterManager = $container->get(FilterManager::class); + $criteriaFilterManager = $container->get(CriteriaManager::class); $criteriaBuilder = $container->get(CriteriaBuilder::class); $documentationProvider = $container->get('ZF\Doctrine\GraphQL\Documentation\DocumentationProvider'); $hydratorAlias = 'ZF\\Doctrine\\GraphQL\\Hydrator\\' . str_replace('\\', '_', $requestedName);