0

Problem is here : Could not determine access type for property "rowElementData" in class "App\Entity\ReportSchemaRowElement". When i change $rowElementData for public this error isnt show up. I know its not correct solution. I dont understand why symfony cannot access to this property, i have methods like for a $rowElementDimensions or $rowElementProperty and this relations are same..

This is my entity code: App\Entity\ReportSchemaRowElement

    <?php

namespace App\Entity;

use ...

/**
 * @ORM\Entity(repositoryClass=ReportSchemaRowElementRepository::class)
 * @ORM\HasLifecycleCallbacks()
 */
class ReportSchemaRowElement
{
    use UuidGenerator;
    
    /**
     * @ORM\Id
     * @ORM\GeneratedValue
     * @ORM\Column(type="integer")
     * @Groups("listing")
     */
    private $id;

    /**
     * @ORM\ManyToOne(targetEntity=ReportSchemaRow::class, inversedBy="reportSchemaRowElements")
     */
    private $row;

    /**
     * @ORM\Column(type="string", length=255)
     * @Groups("listing")
     */
    private $name;

    /**
     * @ORM\Column(type="string", length=255)
     * @Groups("listing")
     */
    private $type;

    /**
     * @ORM\Column(type="integer")
     * @Assert\LessThan(5)
     * @Assert\GreaterThan(0)
     * @Groups("listing")
     */
    private $size;

    /**
     * @ORM\Column(type="integer")
     * @Groups("listing")
     */
    private $priority;

    /**
     * @ORM\Column(type="text")
     */
    private $uuid;

    /**
     * @ORM\OneToMany(targetEntity=RowElementProperty::class, mappedBy="element", cascade={"persist", "remove"})
     * @Groups("listing")
     */
    private $rowElementProperty;

    /**
     * @ORM\OneToMany(targetEntity=RowElementDimension::class, mappedBy="element", cascade={"persist", "remove"})
     * @Groups("listing")
     */
    private $rowElementDimensions;

    /**
     * @ORM\OneToMany(targetEntity=RowElementData::class, mappedBy="element", cascade={"persist", "remove"})
     * @Groups("listing")
     */
    private $rowElementData;

    public function __construct()
    {
        $this->rowElementProperty = new ArrayCollection();
        $this->rowElementDimensions = new ArrayCollection();
        $this->rowElementData = new ArrayCollection();
    }
    
    
    public function getId(): ?int
    {
        return $this->id;
    }

    public function getRow(): ?ReportSchemaRow
    {
        return $this->row;
    }

    public function setRow(?ReportSchemaRow $row): self
    {
        $this->row = $row;

        return $this;
    }

    public function getName(): ?string
    {
        return $this->name;
    }

    public function setName(string $name): self
    {
        $this->name = $name;

        return $this;
    }

    public function getType(): ?string
    {
        return $this->type;
    }

    public function setType(string $type): self
    {
        $this->type = $type;

        return $this;
    }

    public function getSize(): ?int
    {
        return $this->size;
    }

    public function setSize(int $size): self
    {
        $this->size = $size;

        return $this;
    }

    public function getPriority(): ?int
    {
        return $this->priority;
    }

    public function setPriority(int $priority): self
    {
        $this->priority = $priority;

        return $this;
    }

    public function getUuid(): ?string
    {
        return $this->uuid;
    }

    public function setUuid(string $uuid): self
    {
        $this->uuid = $uuid;

        return $this;
    }

    /**
     * Tworzy i ustawia UUID na podstawie hostname oraz unikalnego ID z php.
     * @ORM\PrePersist
     */
    public function generateUuid()
    {
        if ($this->getUuid() === null) {
            $this->makeUuid($this->getName());
        }
    }

    /**
     * @return Collection|RowElementProperty[]
     */
    public function getRowElementProperty(): Collection
    {
        return $this->rowElementProperty;
    }

    public function addRowElementProperty(RowElementProperty $rowElementProperty): self
    {
        if (!$this->rowElementProperty->contains($rowElementProperty)) {
            $this->rowElementProperty[] = $rowElementProperty;
            $rowElementProperty->setElement($this);
        }

        return $this;
    }

    public function removeRowElementProperty(RowElementProperty $rowElementProperty): self
    {
        if ($this->rowElementProperty->removeElement($rowElementProperty)) {
            // set the owning side to null (unless already changed)
            if ($rowElementProperty->getElement() === $this) {
                $rowElementProperty->setElement(null);
            }
        }

        return $this;
    }

    /**
     * @return Collection|RowElementDimension[]
     */
    public function getRowElementDimensions(): Collection
    {
        return $this->rowElementDimensions;
    }

    public function addRowElementDimension(RowElementDimension $rowElementDimension): self
    {
        if (!$this->rowElementDimensions->contains($rowElementDimension)) {
            $this->rowElementDimensions[] = $rowElementDimension;
            $rowElementDimension->setElement($this);
        }

        return $this;
    }

    public function removeRowElementDimension(RowElementDimension $rowElementDimension): self
    {
        if ($this->rowElementDimensions->removeElement($rowElementDimension)) {
            // set the owning side to null (unless already changed)
            if ($rowElementDimension->getElement() === $this) {
                $rowElementDimension->setElement(null);
            }
        }

        return $this;
    }

    /**
     * @return Collection|RowElementData[]
     */
    public function getRowElementData(): Collection
    {
        return $this->rowElementData;
    }

    public function addRowElementData(RowElementData $rowElementData): self
    {
        if (!$this->rowElementData->contains($rowElementData)) {
            $this->rowElementData[] = $rowElementData;
            $rowElementData->setElement($this);
        }

        return $this;
    }

    public function removeRowElementData(RowElementData $rowElementData): self
    {
        if ($this->rowElementData->removeElement($rowElementData)) {
            // set the owning side to null (unless already changed)
            if ($rowElementData->getElement() === $this) {
                $rowElementData->setElement(null);
            }
        }

        return $this;
    }
}
JakiLim
  • 227
  • 3
  • 8
  • this could be very well explained by a stale cache. try clearing the cache (or even removing var/cache and then calling bin/console clear:cache) – Jakumi Feb 16 '21 at 20:20
  • i did it few tiems, unfortunately its not working... really i dont know what is wrong with this. Symfony doesnt see this methods. – JakiLim Feb 17 '21 at 09:59
  • Have you specifically tried to clear doctrine cache? – El_Vanja Feb 17 '21 at 10:05
  • Yes i did it with these three commands: php bin/console doctrine:cache:clear-metadata php bin/console doctrine:cache:clear-query php bin/console doctrine:cache:clear-result – JakiLim Feb 17 '21 at 10:25
  • apart from caching (even APC-cache and stuff) I can't think of a reason, why it wouldn't work, when it works for the other similar properties. Sorry ;o/ – Jakumi Feb 17 '21 at 16:48
  • Are you using Memcached or something similar? In [this question](https://stackoverflow.com/questions/11826444/symfony2-doctrine-clear-cache), people mention it as one of the sources of confusion where doctrine cache didn't seem to clear. – El_Vanja Feb 17 '21 at 19:39
  • i didnt use nothing extra, if you ask about cache is default settings by symfony and doctrine. I ahd to create new field with new name, now its working correct. Is this symfony bug i guess? – JakiLim Feb 18 '21 at 10:42
  • I really wouldn't know. It smells more like a Doctrine bug to me, but I could be wrong. – El_Vanja Feb 18 '21 at 10:46

0 Answers0