From 8e4792a6c4cb8ac31a166835b0813e4462b97bc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20H=C3=BCbner?= Date: Sun, 16 Apr 2017 21:58:24 +0200 Subject: [PATCH] Add UniqueNameTrait --- src/AppBundle/Entity/LDraw/Category.php | 4 +-- src/AppBundle/Entity/LDraw/Keyword.php | 4 +-- .../Entity/Traits/UniqueNameTrait.php | 33 +++++++++++++++++++ 3 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 src/AppBundle/Entity/Traits/UniqueNameTrait.php diff --git a/src/AppBundle/Entity/LDraw/Category.php b/src/AppBundle/Entity/LDraw/Category.php index 549c804..10dda36 100644 --- a/src/AppBundle/Entity/LDraw/Category.php +++ b/src/AppBundle/Entity/LDraw/Category.php @@ -3,7 +3,7 @@ namespace AppBundle\Entity\LDraw; use AppBundle\Entity\Traits\IdentityTrait; -use AppBundle\Entity\Traits\NameTrait; +use AppBundle\Entity\Traits\UniqueNameTrait; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; @@ -17,7 +17,7 @@ use Doctrine\ORM\Mapping as ORM; class Category { use IdentityTrait; - use NameTrait; + use UniqueNameTrait; /** * @var Collection diff --git a/src/AppBundle/Entity/LDraw/Keyword.php b/src/AppBundle/Entity/LDraw/Keyword.php index 1a57071..85aeea3 100644 --- a/src/AppBundle/Entity/LDraw/Keyword.php +++ b/src/AppBundle/Entity/LDraw/Keyword.php @@ -3,7 +3,7 @@ namespace AppBundle\Entity\LDraw; use AppBundle\Entity\Traits\IdentityTrait; -use AppBundle\Entity\Traits\NameTrait; +use AppBundle\Entity\Traits\UniqueNameTrait; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\Mapping as ORM; @@ -16,7 +16,7 @@ use Doctrine\ORM\Mapping as ORM; class Keyword { use IdentityTrait; - use NameTrait; + use UniqueNameTrait; /** * @var ArrayCollection diff --git a/src/AppBundle/Entity/Traits/UniqueNameTrait.php b/src/AppBundle/Entity/Traits/UniqueNameTrait.php new file mode 100644 index 0000000..63c742d --- /dev/null +++ b/src/AppBundle/Entity/Traits/UniqueNameTrait.php @@ -0,0 +1,33 @@ +name; + } + + /** + * @param string $name + * + * @return mixed + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } +}