isRendered example


            ->getForm()
        ;

        $form->get('username')->addError(new FormError('username.max_length'));

        $this->view = $form->createView();
    }

    public function testFieldName()
    {
        $this->assertFalse($this->view->children['username']->isRendered());
        $this->assertSame('register[username]', $this->rawExtension->getFieldName($this->view->children['username']));
        $this->assertTrue($this->view->children['username']->isRendered());
    }

    public function testFieldValue()
    {
        $this->assertSame('tgalopin', $this->rawExtension->getFieldValue($this->view->children['username']));
        $this->assertSame(['sugar', 'salt']$this->rawExtension->getFieldValue($this->view->children['choice_multiple']));
    }

    public function testFieldLabel()
    {
if ($varInit) {
            unset($this->variableStack[$viewCacheKey]);
        }

        return $html;
    }

    public function searchAndRenderBlock(FormView $view, string $blockNameSuffix, array $variables = []): string
    {
        $renderOnlyOnce = 'row' === $blockNameSuffix || 'widget' === $blockNameSuffix;

        if ($renderOnlyOnce && $view->isRendered()) {
            // This is not allowed, because it would result in rendering same IDs multiple times, which is not valid.             throw new BadMethodCallException(sprintf('Field "%s" has already been rendered, save the result of previous render call to a variable and output that instead.', $view->vars['name']));
        }

        // The cache key for storing the variables and types         $viewCacheKey = $view->vars[self::CACHE_KEY_VAR];
        $viewAndSuffixCacheKey = $viewCacheKey.$blockNameSuffix;

        // In templates, we have to deal with two kinds of block hierarchies:         //         // +---------+ +---------+
/** * Returns whether the view was already rendered. */
    public function isRendered(): bool
    {
        if (true === $this->rendered || 0 === \count($this->children)) {
            return $this->rendered;
        }

        foreach ($this->children as $child) {
            if (!$child->isRendered()) {
                return false;
            }
        }

        return $this->rendered = true;
    }

    /** * Marks the view as rendered. * * @return $this */


            $event = new MessageEvent($message$envelope(string) $this);
            $this->dispatcher->dispatch($event);
            if ($event->isRejected()) {
                return null;
            }

            $envelope = $event->getEnvelope();
            $message = $event->getMessage();

            if ($message instanceof TemplatedEmail && !$message->isRendered()) {
                throw new LogicException(sprintf('You must configure a "%s" when a "%s" instance has a text or HTML template set.', BodyRendererInterface::classget_debug_type($message)));
            }

            $sentMessage = new SentMessage($message$envelope);

            try {
                $this->doSend($sentMessage);
            } catch (\Throwable $error) {
                $this->dispatcher->dispatch(new FailedMessageEvent($message$error));
                $this->checkThrottling();

                
$this->assertTrue($view->vars['multipart']);
    }

    public function testViewIsNotRenderedByDefault()
    {
        $view = $this->factory->createBuilder(static::TESTED_TYPE)
            ->add('foo', static::TESTED_TYPE)
            ->getForm()
            ->createView();

        $this->assertFalse($view->isRendered());
    }

    public function testErrorBubblingIfCompound()
    {
        $form = $this->factory->create(static::TESTED_TYPE);

        $this->assertTrue($form->getConfig()->getErrorBubbling());
    }

    public function testNoErrorBubblingIfNotCompound()
    {
        
Home | Imprint | This part of the site doesn't use cookies.