NewsCategory.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?php
  2. namespace internship\bo;
  3. use n2n\reflection\ObjectAdapter;
  4. use n2n\reflection\annotation\AnnoInit;
  5. use n2n\persistence\orm\annotation\AnnoOneToMany;
  6. use n2n\persistence\orm\CascadeType;
  7. use internship\bo\NewsItem;
  8. class NewsCategory extends ObjectAdapter {
  9. private static function _annos(AnnoInit $ai) {
  10. $ai->p('newsItems', new AnnoOneToMany(NewsItem::getClass(), 'category', CascadeType::ALL));
  11. }
  12. private int $id;
  13. private string $title;
  14. private string $lead;
  15. private string $content;
  16. private ?string $imageFile;
  17. private string $urlPart;
  18. private $newsItems;
  19. /**
  20. * @return int
  21. */
  22. public function getId(): int {
  23. return $this->id;
  24. }
  25. /**
  26. * @return string
  27. */
  28. public function getTitle(): string {
  29. return $this->title;
  30. }
  31. /**
  32. * @param string $title
  33. */
  34. public function setTitle(string $title): void {
  35. $this->title = $title;
  36. }
  37. /**
  38. * @return string
  39. */
  40. public function getContent(): string {
  41. return $this->content;
  42. }
  43. /**
  44. * @param string $content
  45. */
  46. public function setContent(string $content): void {
  47. $this->content = $content;
  48. }
  49. /**
  50. * @return string
  51. */
  52. public function getLead(): string {
  53. return $this->lead;
  54. }
  55. /**
  56. * @param string $lead
  57. */
  58. public function setLead(string $lead): void {
  59. $this->lead = $lead;
  60. }
  61. /**
  62. * @return string
  63. */
  64. public function getImageFile(): string {
  65. return $this->imageFile;
  66. }
  67. /**
  68. * @param string $imageFile
  69. */
  70. public function setImageFile(?string $imageFile): void {
  71. $this->imageFile = $imageFile;
  72. }
  73. /**
  74. * @return string
  75. */
  76. public function getUrlPart() {
  77. return $this->urlPart;
  78. }
  79. /**
  80. * @param string $urlPart
  81. */
  82. public function setUrlPart($urlPart) {
  83. $this->urlPart = $urlPart;
  84. }
  85. /**
  86. * @return mixed
  87. */
  88. public function getNewsItems() {
  89. return $this->newsItems;
  90. }
  91. /**
  92. * @param mixed $newsItems
  93. */
  94. public function setNewsItems(\ArrayObject $newsItems): void {
  95. $this->newsItems = $newsItems;
  96. }
  97. }