<?php
namespace Medienreaktor\Persons\Domain\Model;

/***
 *
 * This file is part of the "Persons" Extension for TYPO3 CMS.
 *
 * For the full copyright and license information, please read the
 * LICENSE.txt file that was distributed with this source code.
 *
 *  (c) 2018
 *
 ***/

/**
 * Organisation
 */
class Organisation extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
    /**
     * title
     *
     * @var string
     */
    protected $title = '';

    /**
     * description
     *
     * @var string
     */
    protected $description = '';

    /**
     * image
     *
     * @var \TYPO3\CMS\Extbase\Domain\Model\FileReference
     */
    #[\TYPO3\CMS\Extbase\Annotation\ORM\Cascade(['value' => 'remove'])]
    protected $image = null;


    /**
     * companys
     *
     * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Medienreaktor\Persons\Domain\Model\Company>
     */
    protected $companys = null;


    /**
     * __construct
     */
    public function __construct()
    {
        //Do not remove the next line: It would break the functionality
        $this->initStorageObjects();
    }

    /**
     * Initializes all ObjectStorage properties
     * Do not modify this method!
     * It will be rewritten on each save in the extension builder
     * You may modify the constructor of this class instead
     *
     * @return void
     */
    protected function initStorageObjects()
    {
        $this->companys = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
    }

    /**
     * Returns the title
     *
     * @return string $title
     */
    public function getTitle()
    {
        return $this->title;
    }

    /**
     * Sets the title
     *
     * @param string $title
     * @return void
     */
    public function setTitle($title): void
    {
        $this->title = $title;
    }

    /**
     * Returns the description
     *
     * @return string $description
     */
    public function getDescription()
    {
        return $this->description;
    }

    /**
     * Sets the description
     *
     * @param string $description
     * @return void
     */
    public function setDescription($description): void
    {
        $this->description = $description;
    }

    /**
     * Returns the image
     *
     * @return \TYPO3\CMS\Extbase\Domain\Model\FileReference $image
     */
    public function getImage()
    {
        return $this->image;
    }

    /**
     * Sets the image
     *
     * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $image
     * @return void
     */
    public function setImage(\TYPO3\CMS\Extbase\Domain\Model\FileReference $image): void
    {
        $this->image = $image;
    }

    /**
     * Adds a Company
     *
     * @param \Medienreaktor\Persons\Domain\Model\Company $company
     * @return void
     */
    public function addCompany($company): void
    {
        $this->companys->attach($company);
    }

    /**
     * Removes a Company
     *
     * @param \Medienreaktor\Persons\Domain\Model\Company $companyToRemove
     * @return void
     */
    public function removeCompany($companyToRemove): void
    {
        $this->companys->detach($companyToRemove);
    }

    /**
     * Returns the companys
     *
     * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Medienreaktor\Persons\Domain\Model\Company> companys
     */
    public function getCompanys()
    {
        return $this->companys;
    }

    /**
     * Sets the companys
     *
     * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Medienreaktor\Persons\Domain\Model\Company> $companys
     * @return void
     */
    public function setCompanys(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $companys): void
    {
        $this->companys = $companys;
    }
}
