Created
December 20, 2018 16:46
-
-
Save cybernet/27625809103801f90d9559cb2f422cec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Entity; | |
use Doctrine\Common\Collections\ArrayCollection; | |
use Doctrine\Common\Collections\Collection; | |
use Doctrine\ORM\Mapping as ORM; | |
/** | |
* @ORM\Entity(repositoryClass="App\Repository\CaRepository") | |
*/ | |
class Ca | |
{ | |
/** | |
* @ORM\Id() | |
* @ORM\GeneratedValue() | |
* @ORM\Column(type="integer") | |
*/ | |
private $id; | |
/** | |
* @ORM\Column(type="string", length=255) | |
*/ | |
private $first_name; | |
/** | |
* @ORM\Column(type="string", length=255) | |
*/ | |
private $last_name; | |
/** | |
* @ORM\Column(type="string", length=255, nullable=true) | |
*/ | |
private $email; | |
/** | |
* @ORM\ManyToMany(targetEntity="App\Entity\Da", inversedBy="members") | |
*/ | |
private $rank; | |
/** | |
* @ORM\ManyToOne(targetEntity="App\Entity\Users", inversedBy="members") | |
* @ORM\JoinColumn(nullable=false) | |
*/ | |
private $agency; | |
/** | |
* @ORM\ManyToMany(targetEntity="App\Entity\DaShips", inversedBy="cas") | |
*/ | |
private $ships; | |
public function __construct() | |
{ | |
$this->rank = new ArrayCollection(); | |
$this->ships = new ArrayCollection(); | |
} | |
public function getId(): ?int | |
{ | |
return $this->id; | |
} | |
public function getFirstName(): ?string | |
{ | |
return $this->first_name; | |
} | |
public function setFirstName(string $first_name): self | |
{ | |
$this->first_name = $first_name; | |
return $this; | |
} | |
public function getLastName(): ?string | |
{ | |
return $this->last_name; | |
} | |
public function setLastName(string $last_name): self | |
{ | |
$this->last_name = $last_name; | |
return $this; | |
} | |
public function getEmail(): ?string | |
{ | |
return $this->email; | |
} | |
public function setEmail(?string $email): self | |
{ | |
$this->email = $email; | |
return $this; | |
} | |
/** | |
* @return Collection|Da[] | |
*/ | |
public function getRank(): Collection | |
{ | |
return $this->rank; | |
} | |
public function addRank(Da $rank): self | |
{ | |
if (!$this->rank->contains($rank)) { | |
$this->rank[] = $rank; | |
} | |
return $this; | |
} | |
public function removeRank(Da $rank): self | |
{ | |
if ($this->rank->contains($rank)) { | |
$this->rank->removeElement($rank); | |
} | |
return $this; | |
} | |
public function getAgency(): ?Users | |
{ | |
return $this->agency; | |
} | |
public function setAgency(?Users $agency): self | |
{ | |
$this->agency = $agency; | |
return $this; | |
} | |
/** | |
* @return Collection|DaShips[] | |
*/ | |
public function getShips(): Collection | |
{ | |
return $this->ships; | |
} | |
public function addShip(DaShips $ship): self | |
{ | |
if (!$this->ships->contains($ship)) { | |
$this->ships[] = $ship; | |
} | |
return $this; | |
} | |
public function removeShip(DaShips $ship): self | |
{ | |
if ($this->ships->contains($ship)) { | |
$this->ships->removeElement($ship); | |
} | |
return $this; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Entity; | |
use Doctrine\Common\Collections\ArrayCollection; | |
use Doctrine\Common\Collections\Collection; | |
use Doctrine\ORM\Mapping as ORM; | |
/** | |
* @ORM\Entity(repositoryClass="App\Repository\DaRepository") | |
*/ | |
class Da | |
{ | |
/** | |
* @ORM\Id() | |
* @ORM\GeneratedValue() | |
* @ORM\Column(type="integer") | |
*/ | |
private $id; | |
/** | |
* @ORM\Column(type="string", length=255) | |
*/ | |
private $name; | |
/** | |
* @ORM\ManyToMany(targetEntity="App\Entity\Ca", mappedBy="rank") | |
*/ | |
private $members; | |
public function __construct() | |
{ | |
$this->members = new ArrayCollection(); | |
} | |
public function getId(): ?int | |
{ | |
return $this->id; | |
} | |
public function getName(): ?string | |
{ | |
return $this->name; | |
} | |
public function setName(string $name): self | |
{ | |
$this->name = $name; | |
return $this; | |
} | |
/** | |
* @return Collection|Ca[] | |
*/ | |
public function getMembers(): Collection | |
{ | |
return $this->members; | |
} | |
public function addMember(Ca $member): self | |
{ | |
if (!$this->members->contains($member)) { | |
$this->members[] = $member; | |
$member->addRank($this); | |
} | |
return $this; | |
} | |
public function removeMember(Ca $member): self | |
{ | |
if ($this->members->contains($member)) { | |
$this->members->removeElement($member); | |
$member->removeRank($this); | |
} | |
return $this; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Entity; | |
use Doctrine\Common\Collections\ArrayCollection; | |
use Doctrine\Common\Collections\Collection; | |
use Doctrine\ORM\Mapping as ORM; | |
/** | |
* @ORM\Entity(repositoryClass="App\Repository\DaShipsRepository") | |
*/ | |
class DaShips | |
{ | |
/** | |
* @ORM\Id() | |
* @ORM\GeneratedValue() | |
* @ORM\Column(type="integer") | |
*/ | |
private $id; | |
/** | |
* @ORM\Column(type="string", length=255) | |
*/ | |
private $name; | |
/** | |
* @ORM\Column(type="integer", nullable=true) | |
*/ | |
private $imo; | |
/** | |
* @ORM\Column(type="integer", nullable=true, length=4) | |
*/ | |
private $year; | |
/** | |
* @ORM\ManyToOne(targetEntity="App\Entity\Users", inversedBy="ships") | |
* @ORM\JoinColumn(nullable=false) | |
*/ | |
private $owner; | |
/** | |
* @ORM\Column(type="string", length=255) | |
* @Gedmo\Slug(fields={"name"}) | |
*/ | |
private $slug; | |
/** | |
* @ORM\ManyToOne(targetEntity="App\Entity\ShipType", inversedBy="ships") | |
* @ORM\JoinColumn(nullable=false) | |
*/ | |
private $ShipType; | |
/** | |
* @ORM\ManyToMany(targetEntity="App\Entity\Ca", mappedBy="ships") | |
*/ | |
private $cas; | |
public function __construct() | |
{ | |
// $this->name = new ArrayCollection(); | |
$this->ship_members = new ArrayCollection(); | |
$this->cas = new ArrayCollection(); | |
} | |
public function getId() | |
{ | |
return $this->id; | |
} | |
public function getName(): ?string | |
{ | |
return $this->name; | |
} | |
public function setName(string $name): self | |
{ | |
$this->name = $name; | |
return $this; | |
} | |
public function getImo(): ?int | |
{ | |
return $this->imo; | |
} | |
public function setImo(?int $imo): self | |
{ | |
$this->imo = $imo; | |
return $this; | |
} | |
public function getYear(): ?int | |
{ | |
return $this->year; | |
} | |
public function setYear(?int $year): self | |
{ | |
$this->year = $year; | |
return $this; | |
} | |
public function getOwner(): ?Users | |
{ | |
return $this->owner; | |
} | |
public function setOwner(?Users $owner): self | |
{ | |
$this->owner = $owner; | |
return $this; | |
} | |
public function getSlug(): ?string | |
{ | |
return $this->slug; | |
} | |
public function setSlug(string $slug): self | |
{ | |
$this->slug = $slug; | |
return $this; | |
} | |
public function getShipType(): ?ShipType | |
{ | |
return $this->ShipType; | |
} | |
public function setShipType(?ShipType $ShipType): self | |
{ | |
$this->ShipType = $ShipType; | |
return $this; | |
} | |
/** | |
* @return Collection|Ca[] | |
*/ | |
public function getCas(): Collection | |
{ | |
return $this->cas; | |
} | |
public function addCa(Ca $ca): self | |
{ | |
if (!$this->cas->contains($ca)) { | |
$this->cas[] = $ca; | |
$ca->addShip($this); | |
} | |
return $this; | |
} | |
public function removeCa(Ca $ca): self | |
{ | |
if ($this->cas->contains($ca)) { | |
$this->cas->removeElement($ca); | |
$ca->removeShip($this); | |
} | |
return $this; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment