Find or make a query.

@param  string                     $name
@param  string                     $class
@param  callable|OperationResolver $resolver
@return QueryScaffolder|ListQueryScaffolder
491079
public function query($name, $class, $resolver = null)
    {
        /**
         * @var QueryScaffolder $query
        */
        $query = $this->queries->findByName($name);
        if ($query) {
            return $query;
        }

        $operationScaffold = (new ListQueryScaffolder($name, null, $resolver, $class))
            ->setChainableParent($this);

        $this->queries->push($operationScaffold);

        return $operationScaffold;
    }
91646
public function createResource($class, $name)
    {
        $entity = $this->om->factory($class);

        if ($entity instanceof \Claroline\CoreBundle\Entity\Resource\AbstractResource) {
            $entity->setName($name);

            return $entity;
        }

        throw new WrongClassException(
            "{$class} doesn't extend Claroline\CoreBundle\Entity\Resource\AbstractResource."
        );
    }
985686
public function resolve($name)
    {
        return isset($this->services[$name]) ? $this->iteratorFactory->create($this->services[$name]) : null;
    }
130361
public function resolveClass( $class )
	{
		if ( !is_string( $class ) )
			throw new ResolverException( "Class must be a string" );

		// Check if a class has been mapped to a key
		if ( array_key_exists( $class, $this->classAlias ) )
			try
			{
				return $this->resolve( null, $this->classAlias[$class] );
			}
			catch ( ResolverException $e )
			{
				// Ignore
			}

		// Check if the class has been initialized
		foreach ( $this->instances as $instance )
			if ( get_class( $instance ) == $class )
				return $instance;

		// TODO Other methods to check?

		return false;
	}
213054
public function runResolver($resolver, $parameters = [], $method = null)
	{
		if (is_callable($resolver))
		{
            return call_user_func_array($resolver, $parameters);
        }

        if(class_exists($resolver))
        {
        	$instance = $this->container->make($resolver, $parameters);
		    if($instance instanceof Command)
		    {
		    	return Bus::dispatch($instance, $parameters);
		    }

		    if(is_callable([$instance, $method]))
		    {
		    	 return call_user_func_array([$instance, $method], $parameters);
		    }
        }

        if(strpos($resolver, '@') !== false)
        {
        	list($class, $method) = explode('@', $this->action['uses']);

        	if (!method_exists($instance = $this->container->make($class), $method)) {
		        throw new Exception('Invalid method mapped on object: ' . $class . '.');
		    }

        	return call_user_func_array([$instance, $method], $parameters);
        }

        throw new Exception('Invalid resolver: ' . $resolver . '.');
	}
614532
public function of($class, $name = 'default')
    {
        return new FactoryBuilder(
            $class, $name, $this->definitions, $this->states,
            $this->afterMaking, $this->afterCreating, $this->faker
        );
    }
1317348
public function setRepositoryClass($name, $class)
  {
    if (!class_exists($class) || !in_array('SQRT\DB\Repository', class_parents($class))) {
      Exception::ThrowError(Exception::NOT_REPOSITORY, $class);
    }

    $this->repositories[strtolower($name)] = $class;

    return $this;
  }
987215
public static @Nonnull Class<?> _findClass(ClassLoader cl, String name) throws ClassNotFoundException {
        synchronized (getClassLoadingLock(cl, name)) {
            return (Class) invoke(FIND_CLASS, ClassNotFoundException.class, cl, name);
        }
    }
770024
private function findResolveTarget(ContainerBuilder $container, $class)
    {
        $resolveTargets = $this->getResolveTargets($container);

        if (isset($resolveTargets[$class])) {
            $class = $resolveTargets[$class];
        }

        return $class;
    }
524898
public function of($class, $name = 'default')
    {
        return new FactoryBuilder($this->manager, $class, $name, $this->definitions, $this->states, $this->faker);
    }
1275495
public static function map(array $args, callable $resolver)
    {
        $collection = [];

        static::each($args, function ($arg) use (&$collection, $resolver) {
            $collection[] = $resolver($arg);
        });

        return $collection;
    }
162255
def _resolve(self, klass):
        
        resolver = None

        if self._resolver:
            resolver = self._resolver
        elif self._command:
            resolver = self._command.resolver

        instance = klass()
        instance.set_connection_resolver(resolver)

        if self._command:
            instance.set_command(self._command)

        return instance
1137156
public function Identify($name, $class)
    {
        $method = 'make'.lcfirst($name);
        if(method_exists($this, $method))
            $this->{$name}($class);
    }
594340
public static NamedQuery findNamedQuery(Class<?> type, String name)
    {
        NamedQuery annotatedNamedQuery = (NamedQuery) type.getAnnotation(NamedQuery.class);
        if (annotatedNamedQuery != null) {
            return annotatedNamedQuery;
        }

        NamedQueries annotatedNamedQueries = (NamedQueries) type.getAnnotation(NamedQueries.class);
        if (annotatedNamedQueries != null) {
            NamedQuery[] namedQueries = annotatedNamedQueries.value();
            if (namedQueries != null) {
                for (NamedQuery namedQuery : namedQueries) {
                    if (namedQuery.name().equalsIgnoreCase(name)) {
                        return namedQuery;
                    }
                }
            }
        }
        // no named query with that name
        log.debug("No NamedQuery with name '{}' exists for type '{}'", name, type);
        return null;
    }
408811
public static function countHandlers($class, $name)
    {
        $class = ObjectHelper::getClass($class);
        $count = 0;

        do {
            if (!empty(self::$events[$class][$name])) {
                $count += count(static::$events[$class][$name]);
            }
        } while (($class = get_parent_class($class)) !== false);

        return $count;
    }
380363
protected function fixDoctrineQueryBuilderNormalizer(OptionsResolver $resolver)
    {
        $queryBuilderNormalizer = function (Options $options, $queryBuilder) {
            if (\is_callable($queryBuilder)) {
                $queryBuilder = $queryBuilder($this->entityManager->getRepository($options['class']), $options);

                if (!$queryBuilder instanceof QueryBuilder) {
                    throw new UnexpectedTypeException($queryBuilder, QueryBuilder::class);
                }
            }

            return $queryBuilder;
        };

        $resolver->setNormalizer('query_builder', $queryBuilderNormalizer);
    }
909579
private Method findResolver(Class type) throws IOException {
        List<Method> resolvers = Util.filter(Index.list(CLIResolver.class, Jenkins.get().getPluginManager().uberClassLoader), Method.class);
        for ( ; type!=null; type=type.getSuperclass())
            for (Method m : resolvers)
                if (m.getReturnType()==type)
                    return m;
        return null;
    }