Add SAPBatteryContainerSize entity. #527

This commit is contained in:
Korina Cordero 2020-12-07 05:48:48 +00:00
parent 6a0b53580e
commit 807749c8f5
4 changed files with 93 additions and 0 deletions

View file

@ -472,3 +472,17 @@ access_keys:
label: Update
- id: sap_bsize.delete
label: Delete
- id: sap_csize
label: SAP Battery Container Size Access
acls:
- id: sap_csize.menu
label: Menu
- id: sap_csize.list
label: List
- id: sap_csize.add
label: Add
- id: sap_csize.update
label: Update
- id: sap_csize.delete
label: Delete

View file

@ -79,6 +79,10 @@ main_menu:
acl: sap_bsize.list
label: SAP Battery Sizes
parent: sapbattery
- id: sapcsize_list
acl: sap_csize.list
label: SAP Container Sizes
parent: sapbattery
- id: vehicle

View file

@ -51,6 +51,13 @@ class SAPBattery
*/
protected $flag_new;
// container size
/**
* @ORM\ManyToOne(targetEntity="SAPBatteryContainerSize", inversedBy="batteries")
* @ORM\JoinColumn(name="container_size_id", referencedColumnName="id")
*/
protected $container_size;
public function __construct()
{
$this->date_create = new DateTime();
@ -110,4 +117,16 @@ class SAPBattery
{
return $this->flag_new;
}
public function setContainerSize($container_size)
{
$this->container_size = $container_size;
return $this;
}
public function getContainerSize()
{
return $this->container_size;
}
}

View file

@ -0,0 +1,56 @@
<?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_container_size")
*/
class SAPBatteryContainerSize
{
// 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;
}
}