Closed
Description
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:
symfony demo propertypath
cd propertypath/
bin/console server:start
git init && git add . && git ci -m "Added initial set of files"
- open http://127.0.0.1:8000/en/admin/post/1/edit
- apply this patch:
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',
bin/console doc:sche:up --force
- open http://127.0.0.1:8000/en/admin/post/1/edit <- there is an error, it's normal
- Apply this patch:
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.