Skip to content

[PropertyPath] Metadata are not up to date in dev #21894

Closed
@lyrixx

Description

@lyrixx
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.2.0

In symfony 3.2, when you add a new property in a data object + getter / setter and then you add a new type in the form an error occurs:

Neither the property "summary2" nor one of the methods "getSummary2()", "summary2()", "isSummary2()", "hasSummary2()", "__get()" exist and have public access in class "AppBundle\Entity\Post".


How to reproduce:

diff --git a/src/AppBundle/Entity/Post.php b/src/AppBundle/Entity/Post.php
index 69b0004..2f5526e 100644
--- a/src/AppBundle/Entity/Post.php
+++ b/src/AppBundle/Entity/Post.php
@@ -64,6 +64,11 @@ class Post
     private $summary;
 
     /**
+     * @ORM\Column(type="string", nullable=true)
+     */
+    private $summary2;
+
+    /**
      * @var string
      *
      * @ORM\Column(type="text")
diff --git a/src/AppBundle/Form/PostType.php b/src/AppBundle/Form/PostType.php
index 743df1a..537fe29 100644
--- a/src/AppBundle/Form/PostType.php
+++ b/src/AppBundle/Form/PostType.php
@@ -50,6 +50,9 @@ class PostType extends AbstractType
             ->add('summary', TextareaType::class, [
                 'label' => 'label.summary',
             ])
+            ->add('summary2', TextareaType::class, [
+                'label' => 'label.summary',
+            ])
             ->add('content', null, [
                 'attr' => ['rows' => 20],
                 'label' => 'label.content',
diff --git a/src/AppBundle/Entity/Post.php b/src/AppBundle/Entity/Post.php
index 2f5526e..48c4988 100644
--- a/src/AppBundle/Entity/Post.php
+++ b/src/AppBundle/Entity/Post.php
@@ -221,6 +221,19 @@ class Post
         $this->summary = $summary;
     }
 
+    public function getSummary2()
+    {
+        return $this->summary2;
+    }
+
+    /**
+     * @param string $summary2
+     */
+    public function setSummary2($summary2)
+    {
+        $this->summary2 = $summary2;
+    }
+
     public function addTag(Tag $tag)
     {
         if (!$this->tags->contains($tag)) {

The error is still here. this is not normal.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions