Your IP : 216.73.216.220


Current Path : /var/www/surf/TYPO3/src/surf/Classes/Domain/Model/
Upload File :
Current File : /var/www/surf/TYPO3/src/surf/Classes/Domain/Model/Vendor.php

<?php

declare(strict_types=1);

namespace Torresani\Surf\Domain\Model;


/**
 * This file is part of the "Surf" 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) 2023 Roberto Torresani <roberto@torresani.eu>
 */

/**
 * Vendor
 */
class Vendor extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{

    /**
     * code
     *
     * @var string
     */
    protected $code = null;

    /**
     * name
     *
     * @var string
     */
    protected $name = null;

    /**
     * user
     *
     * @var int
     */
    protected $user = 0;

    /**
     * store
     *
     * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Torresani\Surf\Domain\Model\Store>
     */
    protected $store = null;

    /**
     * __construct
     */
    public function __construct()
    {

        // Do not remove the next line: It would break the functionality
        $this->initializeObject();
    }

    /**
     * Initializes all ObjectStorage properties when model is reconstructed from DB (where __construct is not called)
     * 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
     */
    public function initializeObject()
    {
        $this->store = $this->store ?: new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
    }

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

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

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

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

    /**
     * Adds a Store
     *
     * @param \Torresani\Surf\Domain\Model\Store $store
     * @return void
     */
    public function addStore(\Torresani\Surf\Domain\Model\Store $store)
    {
        $this->store->attach($store);
    }

    /**
     * Removes a Store
     *
     * @param \Torresani\Surf\Domain\Model\Store $storeToRemove The Store to be removed
     * @return void
     */
    public function removeStore(\Torresani\Surf\Domain\Model\Store $storeToRemove)
    {
        $this->store->detach($storeToRemove);
    }

    /**
     * Returns the store
     *
     * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Torresani\Surf\Domain\Model\Store>
     */
    public function getStore()
    {
        return $this->store;
    }

    /**
     * Sets the store
     *
     * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Torresani\Surf\Domain\Model\Store> $store
     * @return void
     */
    public function setStore(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $store)
    {
        $this->store = $store;
    }

    /**
     * Returns the user
     *
     * @return int
     */
    public function getUser()
    {
        return $this->user;
    }

    /**
     * Sets the user
     *
     * @param int $user
     * @return void
     */
    public function setUser(int $user)
    {
        $this->user = $user;
    }
}