mirror of
https://github.com/ToxicCrack/PrintABrick.git
synced 2025-05-17 04:40:08 -07:00
Add UniqueNameTrait
This commit is contained in:
parent
9319b737c5
commit
8e4792a6c4
@ -3,7 +3,7 @@
|
|||||||
namespace AppBundle\Entity\LDraw;
|
namespace AppBundle\Entity\LDraw;
|
||||||
|
|
||||||
use AppBundle\Entity\Traits\IdentityTrait;
|
use AppBundle\Entity\Traits\IdentityTrait;
|
||||||
use AppBundle\Entity\Traits\NameTrait;
|
use AppBundle\Entity\Traits\UniqueNameTrait;
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
@ -17,7 +17,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||||||
class Category
|
class Category
|
||||||
{
|
{
|
||||||
use IdentityTrait;
|
use IdentityTrait;
|
||||||
use NameTrait;
|
use UniqueNameTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Collection
|
* @var Collection
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
namespace AppBundle\Entity\LDraw;
|
namespace AppBundle\Entity\LDraw;
|
||||||
|
|
||||||
use AppBundle\Entity\Traits\IdentityTrait;
|
use AppBundle\Entity\Traits\IdentityTrait;
|
||||||
use AppBundle\Entity\Traits\NameTrait;
|
use AppBundle\Entity\Traits\UniqueNameTrait;
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||||||
class Keyword
|
class Keyword
|
||||||
{
|
{
|
||||||
use IdentityTrait;
|
use IdentityTrait;
|
||||||
use NameTrait;
|
use UniqueNameTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ArrayCollection
|
* @var ArrayCollection
|
||||||
|
33
src/AppBundle/Entity/Traits/UniqueNameTrait.php
Normal file
33
src/AppBundle/Entity/Traits/UniqueNameTrait.php
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace AppBundle\Entity\Traits;
|
||||||
|
|
||||||
|
trait UniqueNameTrait
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @ORM\Column(type="string", length=255, nullable=true, unique=true)
|
||||||
|
*/
|
||||||
|
protected $name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $name
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function setName($name)
|
||||||
|
{
|
||||||
|
$this->name = $name;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user