<?php
namespace Medienreaktor\Persons\Controller;

/***
 *
 * 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
 *
 ***/

/**
 * OrganisationController
 */
class OrganisationController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
{
    /**
     * organisationRepository
     *
     * @var \Medienreaktor\Persons\Domain\Repository\OrganisationRepository
     */
    protected $organisationRepository = null;
    public function __construct(\Medienreaktor\Persons\Domain\Repository\OrganisationRepository $organisationRepository)
    {
        $this->organisationRepository = $organisationRepository;
    }

    /**
     * action list
     *
     * @return void
     */
    public function listAction(): \Psr\Http\Message\ResponseInterface
    {
        $organisations = $this->organisationRepository->findAll();
        $this->view->assign('organisations', $organisations);
        return $this->htmlResponse();
    }

    /**
     * action show
     *
     * @param \Medienreaktor\Persons\Domain\Model\Organisation $organisation
     * @return void
     */
    public function showAction(\Medienreaktor\Persons\Domain\Model\Organisation $organisation): \Psr\Http\Message\ResponseInterface
    {
        $this->view->assign('organisation', $organisation);
        return $this->htmlResponse();
    }

}
