Procházet zdrojové kódy

Model et Repository

develop
Guillaume před 3 roky
rodič
revize
235dfc7359
10 změnil soubory, kde provedl 731 přidání a 0 odebrání
  1. +37
    -0
      Model/AbstractData.php
  2. +40
    -0
      Model/Dream.php
  3. +296
    -0
      Model/IndividualData.php
  4. +39
    -0
      Model/ProjectBoost.php
  5. +40
    -0
      Model/ProjectInspiring.php
  6. +39
    -0
      Model/Revolt.php
  7. +51
    -0
      Model/Subthematic.php
  8. +94
    -0
      Model/Territory.php
  9. +79
    -0
      Model/Thematic.php
  10. +16
    -0
      Resources/config/services.yaml

+ 37
- 0
Model/AbstractData.php Zobrazit soubor

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

namespace Lc\PietroBundle\Model;

use Doctrine\ORM\Mapping as ORM;
use Lc\SovBundle\Doctrine\EntityInterface;
use Lc\SovBundle\Doctrine\Extension\StatusInterface;
use Lc\SovBundle\Doctrine\Extension\StatusTrait;

/**
* @ORM\MappedSuperclass()
*/
abstract class AbstractData implements StatusInterface, EntityInterface
{
use StatusTrait;

const TERRITORY = "Territory";
const CATEGORY_REVOLT = "Revolt";
const CATEGORY_DREAM = "Dream";
const CATEGORY_PROJECTBOOST = "ProjectBoost";
const CATEGORY_PROJECTINSPIRING = "ProjectInspiring";

const CATEGORY_LABEL_REVOLT = "Nos révoltes";
const CATEGORY_LABEL_DREAM = "Nos rêves";
const CATEGORY_LABEL_PROJECTBOOST = "Les actions à booster";
const CATEGORY_LABEL_PROJECTINSPIRING = "Les actions inspirantes";

static function getCategory(): array
{
return [
self::CATEGORY_LABEL_REVOLT => self::CATEGORY_REVOLT,
self::CATEGORY_LABEL_DREAM => self::CATEGORY_DREAM,
self::CATEGORY_LABEL_PROJECTBOOST => self::CATEGORY_PROJECTBOOST,
self::CATEGORY_LABEL_PROJECTINSPIRING => self::CATEGORY_PROJECTINSPIRING,
];
}
}

+ 40
- 0
Model/Dream.php Zobrazit soubor

@@ -0,0 +1,40 @@
<?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;
}

}

+ 296
- 0
Model/IndividualData.php Zobrazit soubor

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

namespace Lc\PietroBundle\Model;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\MappedSuperclass()
*/
abstract class IndividualData extends AbstractData
{

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $firstname;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $lastname;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $email;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $introQuestion;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $introAnswer;

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

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

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

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

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

public function __construct()
{
$this->revolt = new ArrayCollection();
$this->dream = new ArrayCollection();
$this->projectBoost = new ArrayCollection();
$this->projectInspiring = new ArrayCollection();
}

public function getResume()
{
return count($this->getRevolt()) . " révolte(s) - " . count($this->getDream()) . " rêve(s) - " . count(
$this->getProjectBoost()
) . " projet(s) boosté(s) - " . count($this->getProjectInspiring()) . " projets inspirants";
}

public function __toString()
{
return $this->firstname . " " . $this->lastname;
}

public function getNbDream(): string
{
return count($this->getDream());
}

public function getNbRevolt(): string
{
return count($this->getRevolt());
}

public function getNbProjectBoost(): string
{
return count($this->getProjectBoost());
}

public function getNbProjectInspiring(): string
{
return count($this->getProjectInspiring());
}

public function getFirstname(): ?string
{
return $this->firstname;
}

public function setFirstname(string $firstname): self
{
$this->firstname = $firstname;

return $this;
}

public function getLastname(): ?string
{
return $this->lastname;
}

public function setLastname(string $lastname): self
{
$this->lastname = $lastname;

return $this;
}

public function getEmail(): ?string
{
return $this->email;
}

public function setEmail(string $email): self
{
$this->email = $email;

return $this;
}

public function getIntroQuestion(): ?string
{
return $this->introQuestion;
}

public function setIntroQuestion(string $introQuestion): self
{
$this->introQuestion = $introQuestion;

return $this;
}

public function getIntroAnswer(): ?string
{
return $this->introAnswer;
}

public function setIntroAnswer(?string $introAnswer): self
{
$this->introAnswer = $introAnswer;

return $this;
}

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

public function addRevolt(Revolt $revolt): self
{
if (!$this->revolt->contains($revolt)) {
$this->revolt[] = $revolt;
$revolt->setIndividualData($this);
}

return $this;
}

public function removeRevolt(Revolt $revolt): self
{
if ($this->revolt->removeElement($revolt)) {
// set the owning side to null (unless already changed)
if ($revolt->getIndividualData() === $this) {
$revolt->setIndividualData(null);
}
}

return $this;
}

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

public function addDream(Dream $dream): self
{
if (!$this->dream->contains($dream)) {
$this->dream[] = $dream;
$dream->setIndividualData($this);
}

return $this;
}

public function removeDream(Dream $dream): self
{
if ($this->dream->removeElement($dream)) {
// set the owning side to null (unless already changed)
if ($dream->getIndividualData() === $this) {
$dream->setIndividualData(null);
}
}

return $this;
}

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

public function addProjectBoost(ProjectBoost $projectBoost): self
{
if (!$this->projectBoost->contains($projectBoost)) {
$this->projectBoost[] = $projectBoost;
$projectBoost->setIndividualData($this);
}

return $this;
}

public function removeProjectBoost(ProjectBoost $projectBoost): self
{
if ($this->projectBoost->removeElement($projectBoost)) {
// set the owning side to null (unless already changed)
if ($projectBoost->getIndividualData() === $this) {
$projectBoost->setIndividualData(null);
}
}

return $this;
}

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

public function addProjectInspiring(ProjectInspiring $projectInspiring): self
{
if (!$this->projectInspiring->contains($projectInspiring)) {
$this->projectInspiring[] = $projectInspiring;
$projectInspiring->setIndividualData($this);
}

return $this;
}

public function removeProjectInspiring(ProjectInspiring $projectInspiring): self
{
if ($this->projectInspiring->removeElement($projectInspiring)) {
// set the owning side to null (unless already changed)
if ($projectInspiring->getIndividualData() === $this) {
$projectInspiring->setIndividualData(null);
}
}

return $this;
}

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

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

return $this;
}
}

+ 39
- 0
Model/ProjectBoost.php Zobrazit soubor

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

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;

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

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

public function __toString()
{
return "Les actions à booster";
}

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

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

return $this;
}
}

+ 40
- 0
Model/ProjectInspiring.php Zobrazit soubor

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

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;

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

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


public function __toString()
{
return "Les actions inspirantes";
}

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

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

return $this;
}
}

+ 39
- 0
Model/Revolt.php Zobrazit soubor

@@ -0,0 +1,39 @@
<?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 Revolt implements DescriptionProjectInterface, EntityInterface
{
use DescriptionProjectTrait;

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


public function __toString()
{
return "Nos révoltes";
}

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

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

return $this;
}
}

+ 51
- 0
Model/Subthematic.php Zobrazit soubor

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

namespace Lc\PietroBundle\Model;

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

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

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

public function __toString()
{
return $this->name;
}

public function getName(): ?string
{
return $this->name;
}

public function setName(string $name): self
{
$this->name = $name;

return $this;
}

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

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

return $this;
}
}

+ 94
- 0
Model/Territory.php Zobrazit soubor

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

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
{
use DevAliasTrait;


/**
* @ORM\Column(type="string", length=255)
*/
private $name;

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

public function __construct()
{
$this->individualData = new ArrayCollection();
}

public function __toString()
{
return $this->name;
}

public function getName(): ?string
{
return $this->name;
}

public function setName(string $name): self
{
$this->name = $name;

return $this;
}

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

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

return $this;
}

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

public function addTerritory(Territory $territory): self
{
if (!$this->territory->contains($territory)) {
$this->territory[] = $territory;
$territory->setIndividualData($this);
}

return $this;
}

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

return $this;
}
}

+ 79
- 0
Model/Thematic.php Zobrazit soubor

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

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
{

/**
* @ORM\Column(type="string", length=255)
*/
private $name;

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


public function __construct()
{
$this->subthematic = new ArrayCollection();
}

public function __toString()
{
return $this->name;
}

public function getName(): ?string
{
return $this->name;
}

public function setName(string $name): self
{
$this->name = $name;

return $this;
}

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

public function addSubthematic(Subthematic $subthematic): self
{
if (!$this->subthematic->contains($subthematic)) {
$this->subthematic[] = $subthematic;
$subthematic->setThematic($this);
}

return $this;
}

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

return $this;
}
}

+ 16
- 0
Resources/config/services.yaml Zobrazit soubor

@@ -0,0 +1,16 @@
services:
_defaults:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.

Lc\PietroBundle\:
resource: '../../'
exclude:
- '../../DependencyInjection/'
- '../../Entity/'
- '../../Kernel.php'
- '../../Tests/'

Lc\PietroBundle\Controller\:
resource: '../../Controller/'
tags: [ 'controller.service_arguments' ]

Načítá se…
Zrušit
Uložit