Commit cedf001c authored by SpinShare's avatar SpinShare

rename badge to card

parent a47b625f
...@@ -7,9 +7,9 @@ use Doctrine\Common\Collections\Collection; ...@@ -7,9 +7,9 @@ use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**
* @ORM\Entity(repositoryClass="App\Repository\BadgeRepository") * @ORM\Entity(repositoryClass="App\Repository\CardRepository")
*/ */
class Badge class Card
{ {
/** /**
* @ORM\Id() * @ORM\Id()
...@@ -34,7 +34,7 @@ class Badge ...@@ -34,7 +34,7 @@ class Badge
private $icon; private $icon;
/** /**
* @ORM\OneToMany(targetEntity="App\Entity\UserBadge", mappedBy="badge") * @ORM\OneToMany(targetEntity="App\Entity\UserCard", mappedBy="card")
*/ */
private $users; private $users;
...@@ -85,30 +85,30 @@ class Badge ...@@ -85,30 +85,30 @@ class Badge
} }
/** /**
* @return Collection|UserBadge[] * @return Collection|UserCard[]
*/ */
public function getUsers(): Collection public function getUsers(): Collection
{ {
return $this->users; return $this->users;
} }
public function addUser(UserBadge $user): self public function addUser(UserCard $user): self
{ {
if (!$this->users->contains($user)) { if (!$this->users->contains($user)) {
$this->users[] = $user; $this->users[] = $user;
$user->setBadge($this); $user->setCard($this);
} }
return $this; return $this;
} }
public function removeUser(UserBadge $user): self public function removeUser(UserCard $user): self
{ {
if ($this->users->contains($user)) { if ($this->users->contains($user)) {
$this->users->removeElement($user); $this->users->removeElement($user);
// set the owning side to null (unless already changed) // set the owning side to null (unless already changed)
if ($user->getBadge() === $this) { if ($user->getCard() === $this) {
$user->setBadge(null); $user->setCard(null);
} }
} }
......
...@@ -5,9 +5,9 @@ namespace App\Entity; ...@@ -5,9 +5,9 @@ namespace App\Entity;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**
* @ORM\Entity(repositoryClass="App\Repository\UserBadgeRepository") * @ORM\Entity(repositoryClass="App\Repository\UserCardRepository")
*/ */
class UserBadge class UserCard
{ {
/** /**
* @ORM\Id() * @ORM\Id()
...@@ -17,10 +17,10 @@ class UserBadge ...@@ -17,10 +17,10 @@ class UserBadge
private $id; private $id;
/** /**
* @ORM\ManyToOne(targetEntity="App\Entity\Badge", inversedBy="users") * @ORM\ManyToOne(targetEntity="App\Entity\Card", inversedBy="users")
* @ORM\JoinColumn(nullable=false) * @ORM\JoinColumn(nullable=false)
*/ */
private $badge; private $card;
/** /**
* @ORM\Column(type="date") * @ORM\Column(type="date")
...@@ -32,14 +32,14 @@ class UserBadge ...@@ -32,14 +32,14 @@ class UserBadge
return $this->id; return $this->id;
} }
public function getBadge(): ?Badge public function getCard(): ?Card
{ {
return $this->badge; return $this->card;
} }
public function setBadge(?Badge $badge): self public function setCard(?Card $card): self
{ {
$this->badge = $badge; $this->card = $card;
return $this; return $this;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment