Skip to content

Commit

Permalink
Renamed all Criteria objects to Criteria from Filter
Browse files Browse the repository at this point in the history
  • Loading branch information
TomHAnderson committed Jul 3, 2018
1 parent 803dc09 commit 2cd3685
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions src/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -96,7 +96,7 @@ public function getDoctrineGraphQLCriteriaConfig()
{
return [
'abstract_factories' => [
Criteria\FilterTypeAbstractFactory::class,
Criteria\CriteriaTypeAbstractFactory::class,
],
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Zend\ServiceManager\Exception;
use GraphQL\Type\Definition\Type;

class FilterManager extends AbstractPluginManager
class CriteriaManager extends AbstractPluginManager
{
/**
* @var string
Expand Down
10 changes: 10 additions & 0 deletions src/Criteria/CriteriaManagerFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace ZF\Doctrine\GraphQL\Criteria;

use Zend\Mvc\Service\AbstractPluginManagerFactory;

final class CriteriaManagerFactory extends AbstractPluginManagerFactory
{
const PLUGIN_MANAGER_CLASS = CriteriaManager::class;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

use GraphQL\Type\Definition\InputObjectType;

class FilterType extends InputObjectType
class CriteriaType extends InputObjectType
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
use ZF\Doctrine\Criteria\Filter\Service\FilterManager;
use ZF\Doctrine\Criteria\OrderBy\Service\OrderByManager;
use ZF\Doctrine\GraphQL\Type\TypeManager;
use ZF\Doctrine\GraphQL\Criteria\Type as FilterTypeNS;
use ZF\Doctrine\GraphQL\Criteria\Type as CriteriaTypeNS;
use ZF\Doctrine\GraphQL\AbstractAbstractFactory;
use ZF\Doctrine\GraphQL\Event;

final class FilterTypeAbstractFactory extends AbstractAbstractFactory implements
final class CriteriaTypeAbstractFactory extends AbstractAbstractFactory implements
AbstractFactoryInterface
{
/**
Expand Down Expand Up @@ -46,7 +46,7 @@ public function canCreate(ContainerInterface $container, $requestedName)
return isset($config['zf-doctrine-graphql-hydrator'][$hydratorAlias]);
}

public function __invoke(ContainerInterface $container, $requestedName, array $options = null) : FilterType
public function __invoke(ContainerInterface $container, $requestedName, array $options = null) : CriteriaType
{
// @codeCoverageIgnoreStart
if ($this->isCached($requestedName, $options)) {
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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;
Expand Down
10 changes: 0 additions & 10 deletions src/Criteria/FilterManagerFactory.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function init(ModuleManagerInterface $manager)
);

$serviceListener->addServiceManager(
Criteria\FilterManager::class,
Criteria\CriteriaManager::class,
'zf-doctrine-graphql-criteria',
InputObjectType::class,
'getZFDoctrineGraphQLCriteriaConfig'
Expand Down
4 changes: 2 additions & 2 deletions src/Type/EntityTypeAbstractFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 2cd3685

Please sign in to comment.