<?php
namespace AdminBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
/**
* GroupAccounts
*/
#[ORM\Table(name: 'group_accounts')]
#[ORM\Entity(repositoryClass: \AdminBundle\Repository\GroupAccountsRepository::class)]
class GroupAccounts extends BaseEntity
{
/**
* @var int
*/
#[ORM\Column(name: 'id', type: 'integer')]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private $id;
/**
* @var string
*/
#[ORM\Column(name: 'name', type: 'string', length: 255, unique: true)]
private $name;
/**
* @var string
*/
#[ORM\Column(name: 'notes', type: 'text', nullable: true)]
private $notes;
/**
* @var float
*/
#[ORM\Column(name: 'credit', type: 'float', nullable: true)]
private $credit;
/**
* @var ArrayCollection
*/
#[ORM\OneToMany(targetEntity: \Account::class, mappedBy: 'group', cascade: ['persist'], orphanRemoval: true)]
private $accounts;
public function __construct()
{
$this->accounts = new ArrayCollection();
}
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @return ArrayCollection
*/
public function getAccounts()
{
return $this->accounts;
}
/**
* @param ArrayCollection $accounts
* @return $this
*/
public function setAccounts($accounts)
{
$this->accounts = $accounts;
return $this;
}
/**
* @param Account $account
* @return $this
*/
public function addAccount($account) {
$this->accounts->add($account);
return $this;
}
/**
* Set name
*
* @param string $name
*
* @return GroupAccounts
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set notes
*
* @param string $notes
*
* @return GroupAccounts
*/
public function setNotes($notes)
{
$this->notes = $notes;
return $this;
}
/**
* Get notes
*
* @return string
*/
public function getNotes()
{
return $this->notes;
}
/**
* Set credit
*
* @param float $credit
*
* @return GroupAccounts
*/
public function setCredit($credit)
{
$this->credit = $credit;
return $this;
}
/**
* Get credit
*
* @return float
*/
public function getCredit()
{
return $this->credit;
}
public function __toString() {
return '['.$this->getId().']'.$this->getName().'('.$this->getCredit().'£)';
}
}