mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 21:57:16 +02:00
Implemented slug for sources
This commit is contained in:
21
application/src/Entity/Attribut/SlugAttribut.php
Normal file
21
application/src/Entity/Attribut/SlugAttribut.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Attribut;
|
||||
|
||||
trait SlugAttribut
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $slug;
|
||||
|
||||
public function setSlug(string $slug): void
|
||||
{
|
||||
$this->slug = $slug;
|
||||
}
|
||||
|
||||
public function getSlug(): string
|
||||
{
|
||||
return $this->slug;
|
||||
}
|
||||
}
|
10
application/src/Entity/Attribut/SlugAttributInterface.php
Normal file
10
application/src/Entity/Attribut/SlugAttributInterface.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Attribut;
|
||||
|
||||
interface SlugAttributInterface
|
||||
{
|
||||
public function setSlug(string $slug): void;
|
||||
|
||||
public function getSlug(): string;
|
||||
}
|
@@ -15,6 +15,9 @@ use App\Entity\Meta\Law;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use App\Entity\Attribut\MembershipsAttribut;
|
||||
use App\Entity\Source\Complex\Collection\TreeCollectionSourceInterface;
|
||||
use App\Entity\Attribut\SlugAttribut;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
@@ -24,10 +27,22 @@ use App\Entity\Source\Complex\Collection\TreeCollectionSourceInterface;
|
||||
* @ORM\InheritanceType("JOINED")
|
||||
* @ORM\DiscriminatorColumn(name="discr", type="string")
|
||||
* @ORM\DiscriminatorMap({"primitive" = "App\Entity\Source\Primitive\AbstractPrimitiveSource", "collection" = "App\Entity\Source\Complex\Collection\AbstractCollectionSource","operation"="App\Entity\Source\Operation\AbstractOperation"})
|
||||
* @UniqueEntity("slug",ignoreNull=true)
|
||||
*/
|
||||
abstract class AbstractSource extends AbstractEntity implements SourceInterface
|
||||
{
|
||||
use RelationAttribut,MembershipsAttribut, LawAttribut;
|
||||
use RelationAttribut,MembershipsAttribut, LawAttribut,SlugAttribut;
|
||||
|
||||
/**
|
||||
* System slugs should be writen in UPPER CASES
|
||||
* Slugs which are defined by the user are checked via the assert.
|
||||
*
|
||||
* @ORM\Column(type="string",length=30,nullable=true,unique=true)
|
||||
* @Assert\Regex(pattern="/^[a-z]+$/")
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $slug;
|
||||
|
||||
/**
|
||||
* @var RelationInterface
|
||||
|
@@ -7,10 +7,11 @@ use App\Entity\EntityInterface;
|
||||
use App\Entity\Attribut\LawAttributInterface;
|
||||
use App\Entity\Attribut\RelationAttributInterface;
|
||||
use App\Entity\Attribut\MembershipsAttributInterface;
|
||||
use App\Entity\Attribut\SlugAttributInterface;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
interface SourceInterface extends IdAttributInterface, EntityInterface, MembershipsAttributInterface, LawAttributInterface, RelationAttributInterface
|
||||
interface SourceInterface extends IdAttributInterface, EntityInterface, MembershipsAttributInterface, LawAttributInterface, RelationAttributInterface, SlugAttributInterface
|
||||
{
|
||||
}
|
||||
|
Reference in New Issue
Block a user