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

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

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

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

}
