Files
Phraseanet/lib/Alchemy/Phrasea/RouteProcessor/Basket/Root.php
Nicolas Le Goff 1f93a6e17f Route processors
2011-12-15 19:50:17 +01:00

52 lines
1.1 KiB
PHP

<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\RouteProcessor\Basket;
use Alchemy\Phrasea\RouteProcessor;
use Alchemy\Phrasea\RequestHandler;
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class Root extends RouteProcessor\RouteAbstract
{
public function __construct(RequestHandler\WorkZone $request)
{
parent::__construct($request);
}
public function getAllowedMethods()
{
return array('POST');
}
protected function post()
{
$em = $this->getEntityManager();
$Basket = new \Entities\Basket();
$Basket->setName($this->getRequest()->get('name'));
$Basket->setUser($this->getRequest()->get('desc'));
$Basket->setDescription($this->getRequest()->get('desc'));
$em->persist($Basket);
$em->flush();
return new RedirectResponse(sprintf('/%d/', $Basket->getId()));
}
}