Creates the search form and fires an event

@param string $resource
@param string $class
@return \FormObject\Form
432402
protected function makeSearchForm($resource, $class)
    {
        $form = $this->container->make($class);
        $this->publish($resource, 'search-form.created', [$form]);
        $form->addCssClass('search-form');
        return $form;
    }
829416
public function newInstance($class)
    {
        /** @var $form AbstractForm */
        $form = new $class;
        $form->setBaseDependencies(new Builder, new FilterFactory, new HelperLocatorFactory);
        $form->postConstruct();

        return $form;
    }
1000118
public function onCreateForm(CreateFormResourceEvent $event)
    {
        $formFactory = $this->container->get('claroline.form.factory');
        $form = $formFactory->create(FormFactory::TYPE_RESOURCE_TEXT, array('text_'.rand(0, 1000000000)));
        $response = $this->container->get('templating')->render(
            'ClarolineCoreBundle:Text:createForm.html.twig',
            array(
                'form' => $form->createView(),
                'resourceType' => 'text'
            )
        );
        $event->setResponseContent($response);
        $event->stopPropagation();
    }
423517
public static function createFromStdClass(stdClass $class)
	{
		$hash = isset($class->hash) ? $class->hash : null;
		$scope = isset($class->scope) ? $class->scope : null;
		$action = isset($class->action) ? $class->action : null;
		$data = isset($class->data) ? $class->data : null;
		$state = isset($class->state) ? $class->state : null;
		$ip = isset($class->ip) ? $class->ip : null;
		$useragent = isset($class->useragent) ? $class->useragent : null;
		$createdAt = isset($class->created_at) ? $class->created_at : null;

		return new Action($hash, $scope, $action, $data, $state, $ip, $useragent, $createdAt);
	}
655913
public function onCreate(CreateResourceEvent $event)
    {
        $request = $this->container->get('request');
        $form = $this->formFactory->create(new DirectoryType(), new Directory());
        $form->handleRequest($request);

        if ($form->isValid()) {
            $published = $form->get('published')->getData();
            $event->setPublished($published);
            $event->setResources(array($form->getData()));
            $event->stopPropagation();

            return;
        }

        $content = $this->templating->render(
            'ClarolineCoreBundle:Resource:createForm.html.twig',
            array(
                'form' => $form->createView(),
                'resourceType' => 'directory'
            )
        );
        $event->setErrorFormContent($content);
        $event->stopPropagation();
    }
479980
public function searchForm($resource=null)
    {

        $resource = $this->passedOrCurrent($resource);

        if (!$formClass = $this->searchFormClass($resource)) {
            return '';
        }

        return $this->makeSearchForm($resource, $formClass);

    }
561908
public function indexResponse($response, $class)
    {
        $resources = $this->response($response);

        $collection = (new IndexCollection($resources))->map(
            function($resource) use ($class) {
                return new $class($resource);
            }
        );

        $link = $response->getHeader('Link')[0] ?? null;
        $total = $response->getHeader('X-Total-Count')[0] ?? null;

        $collection->setPagination($this->getPageNumber($link), (int) $total);

        return $collection;
    }
760456
public function searchAction( Request $request, $resource, $site = 'default' )
	{
		$cntl = $this->createAdmin( $request, $site, $resource );

		if( ( $html = $cntl->search() ) == '' ) {
			return $cntl->getView()->response();
		}

		return $this->getHtml( $html );
	}
841287
public static function createFromResource(Resource $resource, array $options = [])
    {
        $entity = new self();

        $entity->applyResource($resource);

        return $entity;
    }
244144
public final function makeReleaseFile(AbstractResourceFile $resource) {
        if (!isset($this->__release__file__map[$resource->getMemberId()])) {
            $this->__release__file__map[$resource->getMemberId()] = new File($this->makeReleaseRelativePath($resource), $this->getReleaseDir()->getAbsolutePath());
        }
        return $this->__release__file__map[$resource->getMemberId()];
    }
1030537
public static function fromResource($resource) {
        $newImage = new self();
        try {
            $newImage->setResource($resource);
        } catch(\Exception $e) {
            throw new ImageException($e->getMessage(), ImageException::UnsupportedFormatException, $e);
        }
        return $newImage;
    }
252438
public function bind(Form $form, $class)
    {
        if (!((is_string($class) && class_exists($class)) || ($class instanceof ReflectionClass)))
            throw new BinderException("Provide a classname or a reflection class to bind");

        if ($class instanceof ReflectionClass)
        {
            $refl = $class;
            $class = $refl->getName();
            $isModel = $refl->isSubclassOf(Model::class);
            $isForm = $refl->isSubclassOf(BaseForm::class);
        }
        else
        {
            $refl = new ReflectionClass($class);
            $isModel = $refl->isSubclassOf(Model::class);
            $isForm = $refl->isSubclassOf(BaseForm::class);
        }

        if (!$isModel && !$isForm)
            throw new BinderException("Can only bind subclasses of BaseForm and Model");

        $instance = new $class;
        foreach ($form as $key => $formelement)
        {
            if ($formelement instanceof Form)
                throw new BinderException("Cannot bind nested forms");

            $this->bindValue($formelement, $refl, $instance);
        }
        return $instance;
    }
53004
protected function editClass(core_kernel_classes_Class $clazz, core_kernel_classes_Resource $resource, core_kernel_classes_Class $topclass = null)
    {
        return $this->getClassForm($clazz, $resource, $topclass);
    }
777328
public function create(string $resourceClass, array $options = []): PropertyNameCollection
    {
        $propertyNames = [];
        $propertyNameCollection = null;

        if ($this->decorated) {
            try {
                $propertyNameCollection = $this->decorated->create($resourceClass, $options);
            } catch (ResourceClassNotFoundException $resourceClassNotFoundException) {
                // Ignore not found exceptions from parent
            }

            foreach ($propertyNameCollection as $propertyName) {
                $propertyNames[$propertyName] = $propertyName;
            }
        }

        if (!class_exists($resourceClass)) {
            if (null !== $propertyNameCollection) {
                return $propertyNameCollection;
            }

            throw new ResourceClassNotFoundException(sprintf('The resource class "%s" does not exist.', $resourceClass));
        }

        if ($properties = $this->extractor->getResources()[$resourceClass]['properties'] ?? false) {
            foreach ($properties as $propertyName => $property) {
                $propertyNames[$propertyName] = $propertyName;
            }
        }

        return new PropertyNameCollection(array_values($propertyNames));
    }
1119712
public function delete($resource)
    {
        $event = $this->createResourceEvent($resource);
        $this->dispatcher->dispatch($this->config->getEventName('pre_delete'), $event);

        if (!$event->isPropagationStopped()) {
            $this->removeResource($event);

            $this->dispatcher->dispatch($this->config->getEventName('post_delete'), $event);
        }

        return $event;
    }
1100009
private static function mapResource($resource, $object)
    {
        if ($object == false || is_string($object)) {
            return $object;
        }

        $baseResource = __NAMESPACE__ . '\\' . $resource;
        $class = (class_exists($baseResource)) ? $baseResource : 'Bigcommerce\\Api\\Resources\\' . $resource;
        return new $class($object);
    }
913714
public function createQuery($class, $alias = 'o', $formData = array())
    {
        return new ElasticaProxyQuery($this->repository, $this->baseModelManager->createQuery($class, $alias, $formData));
    }