Advertisement
Guest User

Untitled

a guest
Sep 20th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.24 KB | None | 0 0
  1. <?php
  2.  
  3. namespace GOG\Blog\Domain\Model;
  4.  
  5.  
  6. /***
  7.  *
  8.  * This file is part of the "Blog" Extension for TYPO3 CMS.
  9.  *
  10.  * For the full copyright and license information, please read the
  11.  * LICENSE.txt file that was distributed with this source code.
  12.  *
  13.  *  (c) 2019
  14.  *
  15.  ***/
  16.  
  17. /**
  18.  * Blog
  19.  */
  20. class Tag extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
  21. {
  22.  
  23.     /**
  24.      * Tag title
  25.      *
  26.      * @var string
  27.      */
  28.     protected $title = '';
  29.  
  30.  
  31.     /**
  32.      * children
  33.      *
  34.      * @var  \TYPO3\CMS\Extbase\Persistence\ObjectStorage<Tag>
  35.      */
  36.     protected $subTags = null;
  37.  
  38.  
  39.     public function __construct()
  40.     {
  41.  
  42.         //Do not remove the next line: It would break the functionality
  43.         $this->initStorageObjects();
  44.     }
  45.  
  46.     /**
  47.      * Initializes all ObjectStorage properties
  48.      * Do not modify this method!
  49.      * It will be rewritten on each save in the extension builder
  50.      * You may modify the constructor of this class instead
  51.      *
  52.      * @return void
  53.      */
  54.     protected function initStorageObjects()
  55.     {
  56.         $this->subTags = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
  57.     }
  58.  
  59.  
  60.     /**
  61.      * @param $title string
  62.      */
  63.     public function setTitle($title)
  64.     {
  65.         $this->title = $title;
  66.     }
  67.  
  68.     /**
  69.      * @return string
  70.      */
  71.     public function getTitle() {
  72.         return $this->title;
  73.     }
  74.  
  75.     /**
  76.      * Adds a Tag
  77.      *
  78.      * @param Tag $tag
  79.      * @return void
  80.      */
  81.     public function addSubTag(Tag $tag)
  82.     {
  83.         $this->subTags->attach($tag);
  84.     }
  85.  
  86.     /**
  87.      * Removes a Tag
  88.      *
  89.      * @param Tag $tag
  90.      * @return void
  91.      */
  92.     public function removeSubTag(Tag $tag)
  93.     {
  94.         $this->subTags->detach($tag);
  95.     }
  96.  
  97.     /**
  98.      * Returns the Tags
  99.      *
  100.      * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<Tag> $subTags
  101.      */
  102.     public function getSubTags()
  103.     {
  104.         return $this->subTags;
  105.     }
  106.  
  107.     /**
  108.      * Sets the Tags
  109.      *
  110.      * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<Tag> $tags
  111.      * @return void
  112.      */
  113.     public function setSubTags(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $tags)
  114.     {
  115.         $this->subTags = $tags;
  116.     }
  117.  
  118.  
  119. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement