Skip to content

Commit

Permalink
fix #603 [CoreBundle]: Try to move name field to domain accessor table
Browse files Browse the repository at this point in the history
  • Loading branch information
franzwilding committed May 20, 2019
1 parent ecadd62 commit b376abe
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 74 deletions.
37 changes: 0 additions & 37 deletions src/Bundle/CoreBundle/Entity/ApiKey.php
Expand Up @@ -21,14 +21,6 @@ class ApiKey extends DomainAccessor implements UserInterface, \Serializable
{
static function getType() : string { return 'api_key'; }

/**
* @var string
* @Assert\NotBlank(message="not_blank")
* @Assert\Length(max="255", maxMessage="too_long")
* @ORM\Column(name="name", type="string", length=255)
*/
private $name;

/**
* @var string
* @Assert\NotBlank(message="not_blank")
Expand Down Expand Up @@ -61,35 +53,6 @@ static function getType() : string { return 'api_key'; }
*/
private $created;

public function __toString()
{
return ''.$this->getName();
}

/**
* Set name
*
* @param string $name
*
* @return ApiKey
*/
public function setName($name)
{
$this->name = $name;

return $this;
}

/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}

/**
* @return Organization
*/
Expand Down
37 changes: 37 additions & 0 deletions src/Bundle/CoreBundle/Entity/DomainAccessor.php
Expand Up @@ -30,6 +30,14 @@ abstract class DomainAccessor
*/
protected $id;

/**
* @var string
* @Assert\NotBlank(message="not_blank")
* @Assert\Length(max="255", maxMessage="too_long")
* @ORM\Column(name="name", type="string", length=255)
*/
protected $name;

/**
* @var DomainMember[]
* @Assert\Valid()
Expand All @@ -49,6 +57,11 @@ public function __construct()
$this->domains = new ArrayCollection();
}

public function __toString()
{
return ''.$this->getName();
}

/**
* Get id
*
Expand All @@ -59,6 +72,30 @@ public function getId()
return $this->id;
}

/**
* Set name
*
* @param string $name
*
* @return DomainAccessor
*/
public function setName($name)
{
$this->name = $name;

return $this;
}

/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}

/**
* @return DomainMember[]|ArrayCollection
*/
Expand Down
37 changes: 0 additions & 37 deletions src/Bundle/CoreBundle/Entity/User.php
Expand Up @@ -35,14 +35,6 @@ static function getType() : string { return 'user'; }
*/
private $email;

/**
* @var string
* @Assert\NotBlank(message="not_blank")
* @Assert\Length(max="255", maxMessage="too_long")
* @ORM\Column(name="name", type="string", length=255)
*/
private $name;

/**
* @var string
* @Assert\NotBlank(message="not_blank", groups={"CREATE"})
Expand Down Expand Up @@ -86,11 +78,6 @@ public function __construct()
$this->roles = [self::ROLE_USER];
}

public function __toString()
{
return ''.$this->getName();
}

/**
* Set email
*
Expand All @@ -115,30 +102,6 @@ public function getEmail()
return $this->email;
}

/**
* Set name
*
* @param string $name
*
* @return User
*/
public function setName($name)
{
$this->name = $name;

return $this;
}

/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}

/**
* @param array $roles
*
Expand Down

0 comments on commit b376abe

Please sign in to comment.