| Current Path : /var/www/v3.cesa.co.za/src/ContentBundle/Controller/ |
| Current File : /var/www/v3.cesa.co.za/src/ContentBundle/Controller/FormAdminController.php |
<?php
namespace App\ContentBundle\Controller;
use Sonata\AdminBundle\Controller\CRUDController as Controller;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use App\CoreBundle\Services\ServiceGetterManager;
/**
* Form Admin Controller
*
* @author Otto Saayman <otto@igotafrica.com>
* @package ContentBundle
* @subpackage Controller
* @version 0.0.1
*/
class FormAdminController extends Controller {
/**
* @param $id
*/
public function copyForm(Request $request, ServiceGetterManager $sg, $id): RedirectResponse {
$object = $this->admin->getSubject();
if (!$object) {
throw new NotFoundHttpException(sprintf('unable to find the object with id : %s', $id));
}
$sg->get('form_manager.manager')->copy($object);
$this->addFlash('sonata_flash_success', 'Copied successfully');
return new RedirectResponse($this->admin->generateUrl('list', $this->admin->getFilterParameters()));
}
}