Your IP : 216.73.217.79


Current Path : /var/www/v3.cesa.co.za/src/ContactBundle/Controller/
Upload File :
Current File : /var/www/v3.cesa.co.za/src/ContactBundle/Controller/MailChimpBatchAdminController.php

<?php

namespace App\ContactBundle\Controller;

use App\ContactBundle\Admin\MailChimpBatchAdmin;
use App\ContactBundle\Services\MessageManager;
use Sonata\AdminBundle\Controller\CRUDController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Form\FormView;

/**
 * MailChimp Batch Admin Controller
 *
 * @author Otto Saayman <otto@igotafrica.com>
 * @package ContactBundle
 * @subpackage Controller
 * @version 0.0.1
 */
class MailChimpBatchAdminController extends CRUDController
{
    public function listAction(Request $request): Response
    {
        $this->admin->checkAccess('list');

        $listMode = $request->get('_list_mode');
        if ($listMode) {
            $this->admin->setListMode($listMode);
        }

        $datagrid = $this->admin->getDatagrid();
        $formView = $datagrid->getForm()->createView();

        // Removed call to setFormTheme because it is final in parent

        return $this->renderWithExtraParams(
            'ContactBundle:MailChimpBatch:list.html.twig',
            [
                'action' => 'list',
                'form' => $formView,
                'datagrid' => $datagrid,
                'csrf_token' => $this->getCsrfToken('sonata.batch'),
                'export_formats' => $this->container->has('sonata.admin.admin_exporter') ?
                    $this->container->get('sonata.admin.admin_exporter')->getAvailableFormats($this->admin) :
                    $this->admin->getExportFormats(),
            ],
            null
        );
    }

    public function showAction(Request $request): Response
    {
        $this->admin->checkAccess('show');

        $id = $request->get($this->admin->getIdParameter());
        $object = $this->admin->getObject($id);

        if (!$object) {
            throw new NotFoundHttpException(sprintf('unable to find the object with id: %s', $id));
        }

        return $this->renderWithExtraParams(
            'ContactBundle:MailChimpBatch:show.html.twig',
            [
                'action' => 'show',
                'object' => $object,
                'elements' => $this->admin->getShow(),
            ],
            null
        );
    }
}