Add SAP battery entities #172
This commit is contained in:
parent
3a421a3a68
commit
86c20036c0
3 changed files with 220 additions and 0 deletions
74
src/Entity/SAPBattery.php
Normal file
74
src/Entity/SAPBattery.php
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="sap_battery")
|
||||
*/
|
||||
class SAPBattery
|
||||
{
|
||||
// battery sku
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\Column(type="string", length=25)
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
// brand
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="SAPBatteryBrand", inversedBy="batteries")
|
||||
* @ORM\JoinColumn(name="brand_id", referencedColumnName="id")
|
||||
*/
|
||||
protected $brand;
|
||||
|
||||
// size
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="SAPBatterySize", inversedBy="batteries")
|
||||
* @ORM\JoinColumn(name="size_id", referencedColumnName="id")
|
||||
*/
|
||||
protected $size;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public function setID($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getID()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setBrand($brand)
|
||||
{
|
||||
$this->brand = $brand;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getBrand()
|
||||
{
|
||||
return $this->brand;
|
||||
}
|
||||
|
||||
public function setSize($size)
|
||||
{
|
||||
$this->size = $size;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSize()
|
||||
{
|
||||
return $this->size;
|
||||
}
|
||||
}
|
||||
73
src/Entity/SAPBatteryBrand.php
Normal file
73
src/Entity/SAPBatteryBrand.php
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="sap_battery_brand")
|
||||
*/
|
||||
class SAPBatteryBrand
|
||||
{
|
||||
// unique id
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\Column(type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
// name
|
||||
/**
|
||||
* @ORM\Column(type="string", length=50)
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
// battery
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="Battery", mappedBy="size")
|
||||
*/
|
||||
protected $batteries;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->batteries = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getID()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function addBattery(Battery $battery)
|
||||
{
|
||||
$this->batteries->add($battery);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function clearBatteries()
|
||||
{
|
||||
$this->batteries->clear();
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getBatteries()
|
||||
{
|
||||
return $this->batteries;
|
||||
}
|
||||
}
|
||||
73
src/Entity/SAPBatterySize.php
Normal file
73
src/Entity/SAPBatterySize.php
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="sap_battery_size")
|
||||
*/
|
||||
class SAPBatterySize
|
||||
{
|
||||
// unique id
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\Column(type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
// name
|
||||
/**
|
||||
* @ORM\Column(type="string", length=50)
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
// battery
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="Battery", mappedBy="size")
|
||||
*/
|
||||
protected $batteries;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->batteries = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getID()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function addBattery(Battery $battery)
|
||||
{
|
||||
$this->batteries->add($battery);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function clearBatteries()
|
||||
{
|
||||
$this->batteries->clear();
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getBatteries()
|
||||
{
|
||||
return $this->batteries;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue