Optimized persistence layer annotations

This commit is contained in:
Kevin Frantz 2018-11-11 21:36:23 +01:00
parent 69dbc58954
commit dfde4e34f5
5 changed files with 24 additions and 4 deletions

View File

@ -3,7 +3,17 @@
namespace App\Entity\Source\Combination; namespace App\Entity\Source\Combination;
use App\Entity\Source\AbstractSource; use App\Entity\Source\AbstractSource;
use Doctrine\ORM\Mapping as ORM;
/**
* @author kevinfrantz
*
* @ORM\Entity
* @ORM\Table(name="source_combination")
* @ORM\InheritanceType("JOINED")
* @ORM\DiscriminatorColumn(name="discr", type="string")
* @ORM\DiscriminatorMap({"user" = "UserSource","fullpersonname" = "FullPersonNameSource"})
*/
abstract class AbstractCombinationSource extends AbstractSource implements CombinationSourceInterface abstract class AbstractCombinationSource extends AbstractSource implements CombinationSourceInterface
{ {
} }

View File

@ -12,7 +12,7 @@ use App\Entity\Source\AbstractSource;
* @ORM\Table(name="source_data") * @ORM\Table(name="source_data")
* @ORM\InheritanceType("JOINED") * @ORM\InheritanceType("JOINED")
* @ORM\DiscriminatorColumn(name="discr", type="string") * @ORM\DiscriminatorColumn(name="discr", type="string")
* @ORM\DiscriminatorMap({"user" = "UserSource","name" = "NameSource"}) * @ORM\DiscriminatorMap({"name" = "App\Entity\Source\Data\Name\AbstractNameSource"})
*/ */
abstract class AbstractDataSource extends AbstractSource implements DataSourceInterface abstract class AbstractDataSource extends AbstractSource implements DataSourceInterface
{ {

View File

@ -4,7 +4,17 @@ namespace App\Entity\Source\Data\Name;
use App\Entity\Source\Data\AbstractDataSource; use App\Entity\Source\Data\AbstractDataSource;
use App\Entity\Attribut\NameAttribut; use App\Entity\Attribut\NameAttribut;
use Doctrine\ORM\Mapping as ORM;
/**
* @author kevinfrantz
*
* @ORM\Entity
* @ORM\Table(name="source_data_name")
* @ORM\InheritanceType("JOINED")
* @ORM\DiscriminatorColumn(name="discr", type="string")
* @ORM\DiscriminatorMap({"nickname" = "NicknameSource"})
*/
abstract class AbstractNameSource extends AbstractDataSource implements NameSourceInterface abstract class AbstractNameSource extends AbstractDataSource implements NameSourceInterface
{ {
use NameAttribut; use NameAttribut;

View File

@ -8,8 +8,8 @@ use Symfony\Component\Validator\Constraints as Assert;
/** /**
* @author kevinfrantz * @author kevinfrantz
* @ORM\Table(name="source_data_name") * @ORM\Table(name="source_data_nickname")
* @ORM\Entity(repositoryClass="App\Repository\NameSourceRepository") * @ORM\Entity()
*/ */
final class NicknameSource extends AbstractNameSource implements NicknameSourceInterface final class NicknameSource extends AbstractNameSource implements NicknameSourceInterface
{ {

View File

@ -21,7 +21,7 @@ class User extends BaseUser implements UserInterface
/** /**
* @var UserSourceInterface * @var UserSourceInterface
* @ORM\OneToOne(targetEntity="App\Entity\Source\Data\UserSource",cascade={"persist", "remove"}) * @ORM\OneToOne(targetEntity="App\Entity\Source\Combination\UserSource",cascade={"persist", "remove"})
* @ORM\JoinColumn(name="source_user_id", referencedColumnName="id") * @ORM\JoinColumn(name="source_user_id", referencedColumnName="id")
*/ */
protected $source; protected $source;