K
K
Konstantin Zhikhor2019-06-17 16:48:53
symfony
Konstantin Zhikhor, 2019-06-17 16:48:53

Why is form validation failing in symfony 4?

Hello, tell me please.
Why is my form not validating?
the problem is here
the form itself is problematic. I think the problem is in the title.

<select name="company_card[access_comp_banks][{{ loop.index0 }}][is_short_application]" class="select">
                <option value="0">Стандартная форма анкеты для передачи в банк</option>
                <option value="1" {{ isShortApplication ?? 'checked' }}>Короткая форма анкеты для передачи в банк</option>
            </select>

companyCard.php
/**
     * @ORM\OneToMany(targetEntity="App\Entity\AccessCompBank", mappedBy="company", cascade={"persist"})
     */
    private $accessCompBanks;

    public function __construct()
    {
        $this->accessCompBanks = new ArrayCollection();
    }

/**
     * @return Collection|AccessCompBank[]
     */
    public function getAccessCompBanks(): Collection
    {
        return $this->accessCompBanks;
    }

    public function addAccessCompBank(AccessCompBank $accessCompBank): self
    {
        if (!$this->accessCompBanks->contains($accessCompBank)) {
            $this->accessCompBanks[] = $accessCompBank;
            $accessCompBank->setCompany($this);
        }

        return $this;
    }

    public function removeAccessCompBank(AccessCompBank $accessCompBank): self
    {
        if ($this->accessCompBanks->contains($accessCompBank)) {
            $this->accessCompBanks->removeElement($accessCompBank);
            // set the owning side to null (unless already changed)
            if ($accessCompBank->getCompany() === $this) {
                $accessCompBank->setCompany(null);
            }
        }

        return $this;
    }

AccessCompBanks.php
/**
     * @ORM\Column(type="integer", nullable=true)
     */
    private $is_short_application;
public function getIsShortApplication(): ?int
    {
        return $this->is_short_application;
    }

    public function setIsShortApplication(?int $is_short_application): self
    {
        $this->is_short_application = $is_short_application;

        return $this;
    }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question