Skip to content

Commit 3ebed1c

Browse files
committed
Add annotation with proper types for entity properties
1 parent bd78793 commit 3ebed1c

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

src/AppBundle/Entity/Comment.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,25 @@
3030
class Comment
3131
{
3232
/**
33+
* @var int
34+
*
3335
* @ORM\Id
3436
* @ORM\GeneratedValue
3537
* @ORM\Column(type="integer")
3638
*/
3739
private $id;
3840

3941
/**
42+
* @var Post
43+
*
4044
* @ORM\ManyToOne(targetEntity="Post", inversedBy="comments")
4145
* @ORM\JoinColumn(nullable=false)
4246
*/
4347
private $post;
4448

4549
/**
50+
* @var string
51+
*
4652
* @ORM\Column(type="text")
4753
* @Assert\NotBlank(message="comment.blank")
4854
* @Assert\Length(
@@ -55,12 +61,16 @@ class Comment
5561
private $content;
5662

5763
/**
64+
* @var string
65+
*
5866
* @ORM\Column(type="string")
5967
* @Assert\Email()
6068
*/
6169
private $authorEmail;
6270

6371
/**
72+
* @var \DateTime
73+
*
6474
* @ORM\Column(type="datetime")
6575
* @Assert\DateTime()
6676
*/
@@ -90,6 +100,7 @@ public function getContent()
90100
{
91101
return $this->content;
92102
}
103+
93104
public function setContent($content)
94105
{
95106
$this->content = $content;
@@ -99,6 +110,7 @@ public function getAuthorEmail()
99110
{
100111
return $this->authorEmail;
101112
}
113+
102114
public function setAuthorEmail($authorEmail)
103115
{
104116
$this->authorEmail = $authorEmail;
@@ -108,6 +120,7 @@ public function getPublishedAt()
108120
{
109121
return $this->publishedAt;
110122
}
123+
111124
public function setPublishedAt(\DateTime $publishedAt)
112125
{
113126
$this->publishedAt = $publishedAt;
@@ -117,6 +130,7 @@ public function getPost()
117130
{
118131
return $this->post;
119132
}
133+
120134
public function setPost(Post $post)
121135
{
122136
$this->post = $post;

src/AppBundle/Entity/Post.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,56 +22,74 @@
2222
class Post
2323
{
2424
/**
25+
* @var int
26+
*
2527
* Use constants to define configuration options that rarely change instead
2628
* of specifying them in app/config/config.yml.
2729
* See http://symfony.com/doc/current/best_practices/configuration.html#constants-vs-configuration-options
2830
*/
2931
const NUM_ITEMS = 10;
3032

3133
/**
34+
* @var int
35+
*
3236
* @ORM\Id
3337
* @ORM\GeneratedValue
3438
* @ORM\Column(type="integer")
3539
*/
3640
private $id;
3741

3842
/**
43+
* @var string
44+
*
3945
* @ORM\Column(type="string")
4046
* @Assert\NotBlank()
4147
*/
4248
private $title;
4349

4450
/**
51+
* @var string
52+
*
4553
* @ORM\Column(type="string")
4654
*/
4755
private $slug;
4856

4957
/**
58+
* @var string
59+
*
5060
* @ORM\Column(type="string")
5161
* @Assert\NotBlank(message="post.blank_summary")
5262
*/
5363
private $summary;
5464

5565
/**
66+
* @var string
67+
*
5668
* @ORM\Column(type="text")
5769
* @Assert\NotBlank(message="post.blank_content")
5870
* @Assert\Length(min = "10", minMessage = "post.too_short_content")
5971
*/
6072
private $content;
6173

6274
/**
75+
* @var string
76+
*
6377
* @ORM\Column(type="string")
6478
* @Assert\Email()
6579
*/
6680
private $authorEmail;
6781

6882
/**
83+
* @var \DateTime
84+
*
6985
* @ORM\Column(type="datetime")
7086
* @Assert\DateTime()
7187
*/
7288
private $publishedAt;
7389

7490
/**
91+
* @var Comment[]|ArrayCollection
92+
*
7593
* @ORM\OneToMany(
7694
* targetEntity="Comment",
7795
* mappedBy="post",

src/AppBundle/Entity/User.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,28 +21,38 @@
2121
class User implements UserInterface
2222
{
2323
/**
24+
* @var int
25+
*
2426
* @ORM\Id
2527
* @ORM\GeneratedValue
2628
* @ORM\Column(type="integer")
2729
*/
2830
private $id;
2931

3032
/**
33+
* @var string
34+
*
3135
* @ORM\Column(type="string", unique=true)
3236
*/
3337
private $username;
3438

3539
/**
40+
* @var string
41+
*
3642
* @ORM\Column(type="string", unique=true)
3743
*/
3844
private $email;
3945

4046
/**
47+
* @var string
48+
*
4149
* @ORM\Column(type="string")
4250
*/
4351
private $password;
4452

4553
/**
54+
* @var array
55+
*
4656
* @ORM\Column(type="json_array")
4757
*/
4858
private $roles = [];
@@ -59,6 +69,7 @@ public function getUsername()
5969
{
6070
return $this->username;
6171
}
72+
6273
public function setUsername($username)
6374
{
6475
$this->username = $username;
@@ -68,6 +79,7 @@ public function getEmail()
6879
{
6980
return $this->email;
7081
}
82+
7183
public function setEmail($email)
7284
{
7385
$this->email = $email;
@@ -80,6 +92,7 @@ public function getPassword()
8092
{
8193
return $this->password;
8294
}
95+
8396
public function setPassword($password)
8497
{
8598
$this->password = $password;

0 commit comments

Comments
 (0)