Skip to content

Commit 3929eca

Browse files
committed
minor #9239 Add createdAt property + setter and getter (liviubalan)
This PR was merged into the 2.7 branch. Discussion ---------- Add createdAt property + setter and getter "createdAt" property and "setCreatedAt" is not defined on section "Using Callbacks to Serialize Properties with Object Instances" so the PHP Fatal error is triggered: Call to undefined method Person::setCreatedAt() Commits ------- 5d9d563 Add createdAt property + setter and getter
2 parents 330ce77 + 5d9d563 commit 3929eca

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

components/serializer.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ exists in your project::
7373
private $age;
7474
private $name;
7575
private $sportsman;
76+
private $createdAt;
7677

7778
// Getters
7879
public function getName()
@@ -85,6 +86,11 @@ exists in your project::
8586
return $this->age;
8687
}
8788

89+
public function getCreatedAt()
90+
{
91+
return $this->createdAt;
92+
}
93+
8894
// Issers
8995
public function isSportsman()
9096
{
@@ -106,6 +112,11 @@ exists in your project::
106112
{
107113
$this->sportsman = $sportsman;
108114
}
115+
116+
public function setCreatedAt($createdAt)
117+
{
118+
$this->createdAt = $createdAt;
119+
}
109120
}
110121

111122
Now, if you want to serialize this object into JSON, you only need to

0 commit comments

Comments
 (0)