Implemented has slug and id method

This commit is contained in:
Kevin Frantz 2019-01-13 16:32:00 +01:00
parent d61de6f170
commit bea27399b7
4 changed files with 38 additions and 0 deletions

View File

@ -21,4 +21,9 @@ trait IdAttribut
{ {
return $this->id; return $this->id;
} }
public function hasId(): bool
{
return isset($this->id);
}
} }

View File

@ -7,7 +7,18 @@ namespace App\Entity\Attribut;
*/ */
interface IdAttributInterface interface IdAttributInterface
{ {
/**
* @param int $id
*/
public function setId(int $id): void; public function setId(int $id): void;
/**
* @return int
*/
public function getId(): int; public function getId(): int;
/**
* @return bool Checks if attribute is set
*/
public function hasId(): bool;
} }

View File

@ -2,6 +2,9 @@
namespace App\Entity\Attribut; namespace App\Entity\Attribut;
/**
* @author kevinfrantz
*/
trait SlugAttribut trait SlugAttribut
{ {
/** /**
@ -18,4 +21,9 @@ trait SlugAttribut
{ {
return $this->slug; return $this->slug;
} }
public function hasSlug(): bool
{
return isset($this->slug);
}
} }

View File

@ -2,9 +2,23 @@
namespace App\Entity\Attribut; namespace App\Entity\Attribut;
/**
* @author kevinfrantz
*/
interface SlugAttributInterface interface SlugAttributInterface
{ {
/**
* @param string $slug
*/
public function setSlug(string $slug): void; public function setSlug(string $slug): void;
/**
* @return string
*/
public function getSlug(): string; public function getSlug(): string;
/**
* @return bool Checks if a slug is set
*/
public function hasSlug(): bool;
} }