src/AdminBundle/Entity/GroupAccounts.php line 13

Open in your IDE?
  1. <?php
  2. namespace AdminBundle\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6. * GroupAccounts
  7. */
  8. #[ORM\Table(name: 'group_accounts')]
  9. #[ORM\Entity(repositoryClass: \AdminBundle\Repository\GroupAccountsRepository::class)]
  10. class GroupAccounts extends BaseEntity
  11. {
  12. /**
  13. * @var int
  14. */
  15. #[ORM\Column(name: 'id', type: 'integer')]
  16. #[ORM\Id]
  17. #[ORM\GeneratedValue(strategy: 'AUTO')]
  18. private $id;
  19. /**
  20. * @var string
  21. */
  22. #[ORM\Column(name: 'name', type: 'string', length: 255, unique: true)]
  23. private $name;
  24. /**
  25. * @var string
  26. */
  27. #[ORM\Column(name: 'notes', type: 'text', nullable: true)]
  28. private $notes;
  29. /**
  30. * @var float
  31. */
  32. #[ORM\Column(name: 'credit', type: 'float', nullable: true)]
  33. private $credit;
  34. /**
  35. * @var ArrayCollection
  36. */
  37. #[ORM\OneToMany(targetEntity: \Account::class, mappedBy: 'group', cascade: ['persist'], orphanRemoval: true)]
  38. private $accounts;
  39. public function __construct()
  40. {
  41. $this->accounts = new ArrayCollection();
  42. }
  43. /**
  44. * Get id
  45. *
  46. * @return int
  47. */
  48. public function getId()
  49. {
  50. return $this->id;
  51. }
  52. /**
  53. * @return ArrayCollection
  54. */
  55. public function getAccounts()
  56. {
  57. return $this->accounts;
  58. }
  59. /**
  60. * @param ArrayCollection $accounts
  61. * @return $this
  62. */
  63. public function setAccounts($accounts)
  64. {
  65. $this->accounts = $accounts;
  66. return $this;
  67. }
  68. /**
  69. * @param Account $account
  70. * @return $this
  71. */
  72. public function addAccount($account) {
  73. $this->accounts->add($account);
  74. return $this;
  75. }
  76. /**
  77. * Set name
  78. *
  79. * @param string $name
  80. *
  81. * @return GroupAccounts
  82. */
  83. public function setName($name)
  84. {
  85. $this->name = $name;
  86. return $this;
  87. }
  88. /**
  89. * Get name
  90. *
  91. * @return string
  92. */
  93. public function getName()
  94. {
  95. return $this->name;
  96. }
  97. /**
  98. * Set notes
  99. *
  100. * @param string $notes
  101. *
  102. * @return GroupAccounts
  103. */
  104. public function setNotes($notes)
  105. {
  106. $this->notes = $notes;
  107. return $this;
  108. }
  109. /**
  110. * Get notes
  111. *
  112. * @return string
  113. */
  114. public function getNotes()
  115. {
  116. return $this->notes;
  117. }
  118. /**
  119. * Set credit
  120. *
  121. * @param float $credit
  122. *
  123. * @return GroupAccounts
  124. */
  125. public function setCredit($credit)
  126. {
  127. $this->credit = $credit;
  128. return $this;
  129. }
  130. /**
  131. * Get credit
  132. *
  133. * @return float
  134. */
  135. public function getCredit()
  136. {
  137. return $this->credit;
  138. }
  139. public function __toString() {
  140. return '['.$this->getId().']'.$this->getName().'('.$this->getCredit().'£)';
  141. }
  142. }