Browse Source

interface

develop
charly 3 years ago
parent
commit
5ef66ce6de
25 changed files with 264 additions and 108 deletions
  1. +8
    -0
      Doctrine/Extension/DescriptionProjectInterface.php
  2. +63
    -0
      Doctrine/Extension/DescriptionProjectTrait.php
  3. +2
    -2
      Form/Dream/DreamType.php
  4. +0
    -40
      Model/Dream.php
  5. +8
    -0
      Model/DreamInterface.php
  6. +39
    -0
      Model/DreamModel.php
  7. +20
    -20
      Model/IndividualData.php
  8. +8
    -0
      Model/IndividualDataInterface.php
  9. +4
    -6
      Model/ProjectBoost.php
  10. +8
    -0
      Model/ProjectBoostInterface.php
  11. +6
    -8
      Model/ProjectInspiring.php
  12. +8
    -0
      Model/ProjectInspiringInterface.php
  13. +6
    -7
      Model/Revolt.php
  14. +8
    -0
      Model/RevoltInterface.php
  15. +4
    -5
      Model/Subthematic.php
  16. +8
    -0
      Model/SubthematicInterface.php
  17. +6
    -8
      Model/Territory.php
  18. +8
    -0
      Model/TerritoryInterface.php
  19. +5
    -7
      Model/Thematic.php
  20. +8
    -0
      Model/ThematicInterface.php
  21. +2
    -2
      Repository/Dream/DreamRepository.php
  22. +1
    -1
      Repository/Dream/DreamRepositoryQuery.php
  23. +8
    -0
      Repository/Dream/DreamRepositoryQueryInterface.php
  24. +18
    -2
      Repository/Dream/DreamStore.php
  25. +8
    -0
      Repository/Dream/DreamStoreInterface.php

+ 8
- 0
Doctrine/Extension/DescriptionProjectInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\PietroBundle\Doctrine\Extension;

interface DescriptionProjectInterface
{

}

+ 63
- 0
Doctrine/Extension/DescriptionProjectTrait.php View File

@@ -0,0 +1,63 @@
<?php

namespace Lc\PietroBundle\Doctrine\Extension;

use Lc\PietroBundle\Model\ThematicInterface;
use Lc\PietroBundle\Model\SubthematicInterface;
use Doctrine\ORM\Mapping as ORM;

trait DescriptionProjectTrait
{

/**
* @ORM\Column(type="text")
*/
private $description;

/**
* @ORM\ManyToOne(targetEntity="Lc\PietroBundle\Model\ThematicInterface")
*/
private $thematic;

/**
* @ORM\ManyToOne(targetEntity="Lc\PietroBundle\Model\SubthematicInterface")
*/
private $subthematic;

public function getDescription(): ?string
{
return $this->description;
}

public function setDescription(string $description): self
{
$this->description = $description;

return $this;
}

public function getThematic(): ?ThematicInterface
{
return $this->thematic;
}

public function setThematic(?ThematicInterface $thematic): self
{
$this->thematic = $thematic;

return $this;
}

public function getSubthematic(): ?SubthematicInterface
{
return $this->subthematic;
}

public function setSubthematic(?SubthematicInterface $subthematic): self
{
$this->subthematic = $subthematic;

return $this;
}

}

+ 2
- 2
Form/Dream/DreamType.php View File

@@ -2,7 +2,7 @@

namespace Lc\PietroBundle\Form\Dream;

use Lc\PietroBundle\Model\Dream;
use Lc\PietroBundle\Model\DreamModel;
use Lc\PietroBundle\Model\Subthematic;
use Lc\PietroBundle\Model\Thematic;
use Lc\SovBundle\Doctrine\EntityManager;
@@ -82,7 +82,7 @@ class DreamType extends AbstractType
{
$resolver->setDefaults(
[
'data_class' => $this->em->getEntityName(Dream::class),
'data_class' => $this->em->getEntityName(DreamModel::class),
'context' => 'backend'
]
);

+ 0
- 40
Model/Dream.php View File

@@ -1,40 +0,0 @@
<?php

namespace Lc\PietroBundle\Model;

use Doctrine\ORM\Mapping as ORM;
use App\Doctrine\Extension\DescriptionProjectInterface;
use App\Doctrine\Extension\DescriptionProjectTrait;
use Lc\SovBundle\Doctrine\EntityInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class Dream implements DescriptionProjectInterface, EntityInterface
{
use DescriptionProjectTrait;

/**
* @ORM\ManyToOne(targetEntity=IndividualData::class, inversedBy="dream")
*/
private $individualData;


public function __toString()
{
return "Nos rêves";
}

public function getIndividualData(): ?IndividualData
{
return $this->individualData;
}

public function setIndividualData(?IndividualData $individualData): self
{
$this->individualData = $individualData;

return $this;
}

}

+ 8
- 0
Model/DreamInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\PietroBundle\Model;

interface DreamInterface
{

}

+ 39
- 0
Model/DreamModel.php View File

@@ -0,0 +1,39 @@
<?php

namespace Lc\PietroBundle\Model;

use Doctrine\ORM\Mapping as ORM;
use Lc\PietroBundle\Doctrine\Extension\DescriptionProjectInterface;
use Lc\PietroBundle\Doctrine\Extension\DescriptionProjectTrait;

/**
* @ORM\MappedSuperclass()
*/
abstract class DreamModel implements DescriptionProjectInterface, DreamInterface
{
use DescriptionProjectTrait;

/**
* @ORM\ManyToOne(targetEntity="Lc\PietroBundle\Model\IndividualDataInterface", inversedBy="dream")
*/
private $individualData;


public function __toString()
{
return "Nos rêves";
}

public function getIndividualData(): ?IndividualDataInterface
{
return $this->individualData;
}

public function setIndividualData(?IndividualDataInterface $individualData): self
{
$this->individualData = $individualData;

return $this;
}

}

+ 20
- 20
Model/IndividualData.php View File

@@ -9,7 +9,7 @@ use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\MappedSuperclass()
*/
abstract class IndividualData extends AbstractData
abstract class IndividualData extends AbstractData implements IndividualDataInterface
{

/**
@@ -38,27 +38,27 @@ abstract class IndividualData extends AbstractData
private $introAnswer;

/**
* @ORM\OneToMany(targetEntity=Revolt::class, mappedBy="individualData", cascade={"persist", "remove"})
* @ORM\OneToMany(targetEntity="Lc\PietroBundle\Model\RevoltInterface", mappedBy="individualData", cascade={"persist", "remove"})
*/
protected $revolt;

/**
* @ORM\OneToMany(targetEntity=Dream::class, mappedBy="individualData", cascade={"persist", "remove"})
* @ORM\OneToMany(targetEntity="Lc\PietroBundle\Model\DreamInterface", mappedBy="individualData", cascade={"persist", "remove"})
*/
protected $dream;

/**
* @ORM\OneToMany(targetEntity=ProjectBoost::class, mappedBy="individualData", cascade={"persist", "remove"})
* @ORM\OneToMany(targetEntity="Lc\PietroBundle\Model\ProjectBoostInterface", mappedBy="individualData", cascade={"persist", "remove"})
*/
protected $projectBoost;

/**
* @ORM\OneToMany(targetEntity=ProjectInspiring::class, mappedBy="individualData", cascade={"persist", "remove"})
* @ORM\OneToMany(targetEntity="Lc\PietroBundle\Model\ProjectInspiringInterface", mappedBy="individualData", cascade={"persist", "remove"})
*/
protected $projectInspiring;

/**
* @ORM\ManyToOne(targetEntity=Territory::class, inversedBy="individualData")
* @ORM\ManyToOne(targetEntity="Lc\PietroBundle\Model\TerritoryInterface", inversedBy="individualData")
*/
protected $territory;

@@ -163,14 +163,14 @@ abstract class IndividualData extends AbstractData
}

/**
* @return Collection|Revolt[]
* @return Collection|RevoltInterface[]
*/
public function getRevolt(): Collection
{
return $this->revolt;
}

public function addRevolt(Revolt $revolt): self
public function addRevolt(RevoltInterface $revolt): self
{
if (!$this->revolt->contains($revolt)) {
$this->revolt[] = $revolt;
@@ -180,7 +180,7 @@ abstract class IndividualData extends AbstractData
return $this;
}

public function removeRevolt(Revolt $revolt): self
public function removeRevolt(RevoltInterface $revolt): self
{
if ($this->revolt->removeElement($revolt)) {
// set the owning side to null (unless already changed)
@@ -193,14 +193,14 @@ abstract class IndividualData extends AbstractData
}

/**
* @return Collection|Dream[]
* @return Collection|DreamInterface[]
*/
public function getDream(): Collection
{
return $this->dream;
}

public function addDream(Dream $dream): self
public function addDream(DreamInterface $dream): self
{
if (!$this->dream->contains($dream)) {
$this->dream[] = $dream;
@@ -210,7 +210,7 @@ abstract class IndividualData extends AbstractData
return $this;
}

public function removeDream(Dream $dream): self
public function removeDream(DreamInterface $dream): self
{
if ($this->dream->removeElement($dream)) {
// set the owning side to null (unless already changed)
@@ -223,14 +223,14 @@ abstract class IndividualData extends AbstractData
}

/**
* @return Collection|ProjectBoost[]
* @return Collection|ProjectBoostInterface[]
*/
public function getProjectBoost(): Collection
{
return $this->projectBoost;
}

public function addProjectBoost(ProjectBoost $projectBoost): self
public function addProjectBoost(ProjectBoostInterface $projectBoost): self
{
if (!$this->projectBoost->contains($projectBoost)) {
$this->projectBoost[] = $projectBoost;
@@ -240,7 +240,7 @@ abstract class IndividualData extends AbstractData
return $this;
}

public function removeProjectBoost(ProjectBoost $projectBoost): self
public function removeProjectBoost(ProjectBoostInterface $projectBoost): self
{
if ($this->projectBoost->removeElement($projectBoost)) {
// set the owning side to null (unless already changed)
@@ -253,14 +253,14 @@ abstract class IndividualData extends AbstractData
}

/**
* @return Collection|ProjectInspiring[]
* @return Collection|ProjectInspiringInterface[]
*/
public function getProjectInspiring(): Collection
{
return $this->projectInspiring;
}

public function addProjectInspiring(ProjectInspiring $projectInspiring): self
public function addProjectInspiring(ProjectInspiringInterface $projectInspiring): self
{
if (!$this->projectInspiring->contains($projectInspiring)) {
$this->projectInspiring[] = $projectInspiring;
@@ -270,7 +270,7 @@ abstract class IndividualData extends AbstractData
return $this;
}

public function removeProjectInspiring(ProjectInspiring $projectInspiring): self
public function removeProjectInspiring(ProjectInspiringInterface $projectInspiring): self
{
if ($this->projectInspiring->removeElement($projectInspiring)) {
// set the owning side to null (unless already changed)
@@ -282,12 +282,12 @@ abstract class IndividualData extends AbstractData
return $this;
}

public function getTerritory(): ?Territory
public function getTerritory(): ?TerritoryInterface
{
return $this->territory;
}

public function setTerritory(?Territory $territory): self
public function setTerritory(?TerritoryInterface $territory): self
{
$this->territory = $territory;


+ 8
- 0
Model/IndividualDataInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\PietroBundle\Model;

interface IndividualDataInterface
{

}

+ 4
- 6
Model/ProjectBoost.php View File

@@ -2,21 +2,19 @@

namespace Lc\PietroBundle\Model;

use App\Repository\ProjectBoostRepository;
use Doctrine\ORM\Mapping as ORM;
use App\Doctrine\Extension\DescriptionProjectInterface;
use App\Doctrine\Extension\DescriptionProjectTrait;
use Lc\SovBundle\Doctrine\EntityInterface;
use Lc\PietroBundle\Doctrine\Extension\DescriptionProjectInterface;
use Lc\PietroBundle\Doctrine\Extension\DescriptionProjectTrait;

/**
* @ORM\MappedSuperclass()
*/
abstract class ProjectBoost implements DescriptionProjectInterface, EntityInterface
abstract class ProjectBoost implements DescriptionProjectInterface, ProjectBoostInterface
{
use DescriptionProjectTrait;

/**
* @ORM\ManyToOne(targetEntity=IndividualData::class, inversedBy="projectBoost")
* @ORM\ManyToOne(targetEntity="Lc\PietroBundle\Model\IndividualDataInterface", inversedBy="projectBoost")
*/
private $individualData;


+ 8
- 0
Model/ProjectBoostInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\PietroBundle\Model;

interface ProjectBoostInterface
{

}

+ 6
- 8
Model/ProjectInspiring.php View File

@@ -2,21 +2,19 @@

namespace Lc\PietroBundle\Model;

use App\Repository\ProjectInspiringRepository;
use Doctrine\ORM\Mapping as ORM;
use App\Doctrine\Extension\DescriptionProjectInterface;
use App\Doctrine\Extension\DescriptionProjectTrait;
use Lc\SovBundle\Doctrine\EntityInterface;
use Lc\PietroBundle\Doctrine\Extension\DescriptionProjectInterface;
use Lc\PietroBundle\Doctrine\Extension\DescriptionProjectTrait;

/**
* @ORM\MappedSuperclass()
*/
abstract class ProjectInspiring implements DescriptionProjectInterface, EntityInterface
abstract class ProjectInspiring implements DescriptionProjectInterface, ProjectInspiringInterface
{
use DescriptionProjectTrait;

/**
* @ORM\ManyToOne(targetEntity=IndividualData::class, inversedBy="projectInspiring")
* @ORM\ManyToOne(targetEntity="Lc\PietroBundle\Model\IndividualDataInterface", inversedBy="projectInspiring")
*/
private $individualData;

@@ -26,12 +24,12 @@ abstract class ProjectInspiring implements DescriptionProjectInterface, EntityIn
return "Les actions inspirantes";
}

public function getIndividualData(): ?IndividualData
public function getIndividualData(): ?IndividualDataInterface
{
return $this->individualData;
}

public function setIndividualData(?IndividualData $individualData): self
public function setIndividualData(?IndividualDataInterface $individualData): self
{
$this->individualData = $individualData;


+ 8
- 0
Model/ProjectInspiringInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\PietroBundle\Model;

interface ProjectInspiringInterface
{

}

+ 6
- 7
Model/Revolt.php View File

@@ -3,19 +3,18 @@
namespace Lc\PietroBundle\Model;

use Doctrine\ORM\Mapping as ORM;
use App\Doctrine\Extension\DescriptionProjectInterface;
use App\Doctrine\Extension\DescriptionProjectTrait;
use Lc\SovBundle\Doctrine\EntityInterface;
use Lc\PietroBundle\Doctrine\Extension\DescriptionProjectInterface;
use Lc\PietroBundle\Doctrine\Extension\DescriptionProjectTrait;

/**
* @ORM\MappedSuperclass()
*/
abstract class Revolt implements DescriptionProjectInterface, EntityInterface
abstract class Revolt implements DescriptionProjectInterface, RevoltInterface
{
use DescriptionProjectTrait;

/**
* @ORM\ManyToOne(targetEntity=IndividualData::class, inversedBy="revolt")
* @ORM\ManyToOne(targetEntity="Lc\PietroBundle\Model\IndividualDataInterface", inversedBy="revolt")
*/
private $individualData;

@@ -25,12 +24,12 @@ abstract class Revolt implements DescriptionProjectInterface, EntityInterface
return "Nos révoltes";
}

public function getIndividualData(): ?IndividualData
public function getIndividualData(): ?IndividualDataInterface
{
return $this->individualData;
}

public function setIndividualData(?IndividualData $individualData): self
public function setIndividualData(?IndividualDataInterface $individualData): self
{
$this->individualData = $individualData;


+ 8
- 0
Model/RevoltInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\PietroBundle\Model;

interface RevoltInterface
{

}

+ 4
- 5
Model/Subthematic.php View File

@@ -3,12 +3,11 @@
namespace Lc\PietroBundle\Model;

use Doctrine\ORM\Mapping as ORM;
use Lc\SovBundle\Doctrine\EntityInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class Subthematic implements EntityInterface
abstract class Subthematic implements SubthematicInterface
{
/**
* @ORM\Column(type="string", length=255)
@@ -16,7 +15,7 @@ abstract class Subthematic implements EntityInterface
private $name;

/**
* @ORM\ManyToOne(targetEntity=Thematic::class, inversedBy="subthematic")
* @ORM\ManyToOne(targetEntity="Lc\PietroBundle\Model\ThematicInterface", inversedBy="subthematic")
*/
private $thematic;

@@ -37,12 +36,12 @@ abstract class Subthematic implements EntityInterface
return $this;
}

public function getThematic(): ?Thematic
public function getThematic(): ?ThematicInterface
{
return $this->thematic;
}

public function setThematic(?Thematic $thematic): self
public function setThematic(?ThematicInterface $thematic): self
{
$this->thematic = $thematic;


+ 8
- 0
Model/SubthematicInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\PietroBundle\Model;

interface SubthematicInterface
{

}

+ 6
- 8
Model/Territory.php View File

@@ -2,18 +2,16 @@

namespace Lc\PietroBundle\Model;

use App\Repository\TerritoryRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\SovBundle\Doctrine\EntityInterface;
use Lc\SovBundle\Doctrine\Extension\DevAliasInterface;
use Lc\SovBundle\Doctrine\Extension\DevAliasTrait;

/**
* @ORM\MappedSuperclass()
*/
abstract class Territory implements EntityInterface, DevAliasInterface
abstract class Territory implements TerritoryInterface, DevAliasInterface
{
use DevAliasTrait;

@@ -24,7 +22,7 @@ abstract class Territory implements EntityInterface, DevAliasInterface
private $name;

/**
* @ORM\OneToMany(targetEntity=IndividualData::class, mappedBy="territory")
* @ORM\OneToMany(targetEntity="Lc\PietroBundle\Model\IndividualDataInterface", mappedBy="territory")
*/
private $individualData;

@@ -55,7 +53,7 @@ abstract class Territory implements EntityInterface, DevAliasInterface
return $this->individualData;
}

public function setIndividualData(?IndividualData $individualData): self
public function setIndividualData(?IndividualDataInterface $individualData): self
{
$this->individualData = $individualData;

@@ -63,14 +61,14 @@ abstract class Territory implements EntityInterface, DevAliasInterface
}

/**
* @return Collection|Territory[]
* @return Collection|TerritoryInterface[]
*/
public function getTerritory(): Collection
{
return $this->territory;
}

public function addTerritory(Territory $territory): self
public function addTerritory(TerritoryInterface $territory): self
{
if (!$this->territory->contains($territory)) {
$this->territory[] = $territory;
@@ -80,7 +78,7 @@ abstract class Territory implements EntityInterface, DevAliasInterface
return $this;
}

public function removeTerritory(Territory $territory): self
public function removeTerritory(TerritoryInterface $territory): self
{
if ($this->territory->removeElement($territory)) {
// set the owning side to null (unless already changed)

+ 8
- 0
Model/TerritoryInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\PietroBundle\Model;

interface TerritoryInterface
{

}

+ 5
- 7
Model/Thematic.php View File

@@ -2,16 +2,14 @@

namespace Lc\PietroBundle\Model;

use App\Repository\ThematicRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\SovBundle\Doctrine\EntityInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class Thematic implements EntityInterface
abstract class Thematic implements ThematicInterface
{

/**
@@ -20,7 +18,7 @@ abstract class Thematic implements EntityInterface
private $name;

/**
* @ORM\OneToMany(targetEntity=Subthematic::class, mappedBy="thematic", cascade={"persist", "remove"})
* @ORM\OneToMany(targetEntity="Lc\PietroBundle\Model\SubthematicInterface", mappedBy="thematic", cascade={"persist", "remove"})
*/
private $subthematic;

@@ -48,14 +46,14 @@ abstract class Thematic implements EntityInterface
}

/**
* @return Collection|Subthematic[]
* @return Collection|SubthematicInterface[]
*/
public function getSubthematic(): Collection
{
return $this->subthematic;
}

public function addSubthematic(Subthematic $subthematic): self
public function addSubthematic(SubthematicInterface $subthematic): self
{
if (!$this->subthematic->contains($subthematic)) {
$this->subthematic[] = $subthematic;
@@ -65,7 +63,7 @@ abstract class Thematic implements EntityInterface
return $this;
}

public function removeSubthematic(Subthematic $subthematic): self
public function removeSubthematic(SubthematicInterface $subthematic): self
{
if ($this->subthematic->removeElement($subthematic)) {
// set the owning side to null (unless already changed)

+ 8
- 0
Model/ThematicInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\PietroBundle\Model;

interface ThematicInterface
{

}

+ 2
- 2
Repository/Dream/DreamRepository.php View File

@@ -2,7 +2,7 @@

namespace Lc\PietroBundle\Repository\Dream;

use Lc\PietroBundle\Model\Dream;
use Lc\PietroBundle\Model\DreamModel;
use Lc\SovBundle\Repository\AbstractRepository;
use Doctrine\Persistence\ManagerRegistry;

@@ -10,6 +10,6 @@ class DreamRepository extends AbstractRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Dream::class);
parent::__construct($registry, DreamModel::class);
}
}

+ 1
- 1
Repository/Dream/DreamRepositoryQuery.php View File

@@ -5,7 +5,7 @@ namespace Lc\PietroBundle\Repository\Dream;
use Knp\Component\Pager\PaginatorInterface;
use Lc\PietroBundle\Repository\Search\SearchRepositoryQuery;

class DreamRepositoryQuery extends SearchRepositoryQuery
class DreamRepositoryQuery extends SearchRepositoryQuery implements DreamRepositoryQueryInterface
{
public function __construct(DreamRepository $repository, PaginatorInterface $paginator)
{

+ 8
- 0
Repository/Dream/DreamRepositoryQueryInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\PietroBundle\Repository\Dream;

interface DreamRepositoryQueryInterface
{

}

+ 18
- 2
Repository/Dream/DreamStore.php View File

@@ -3,13 +3,29 @@
namespace Lc\PietroBundle\Repository\Dream;

use Lc\PietroBundle\Repository\Search\SearchStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface;

class DreamStore extends SearchStore
class DreamStore extends SearchStore implements DreamStoreInterface
{
protected $query;

public function __construct(DreamRepositoryQuery $query)
public function __construct(DreamRepositoryQueryInterface $query)
{
$this->query = $query;
}

public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{
return $query;
}

public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{
return $query;
}

public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{
return $query;
}
}

+ 8
- 0
Repository/Dream/DreamStoreInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\PietroBundle\Repository\Dream;

interface DreamStoreInterface
{

}

Loading…
Cancel
Save