removed old cookie stuff from middleware

This commit is contained in:
Steffen Vogel 2011-07-20 12:59:48 +02:00
parent 60991480eb
commit 834485fb4e
3 changed files with 0 additions and 42 deletions

View file

@ -78,10 +78,6 @@ class AggregatorController extends EntityController {
$aggregator = new Model\Aggregator($type);
$this->setProperties($aggregator, $this->view->request->getParameters());
$this->em->persist($aggregator);
if ($this->view->request->getParameter('setcookie')) {
$this->setCookie($channel);
}
}
$this->em->flush();

View file

@ -68,10 +68,6 @@ class ChannelController extends EntityController {
$this->em->persist($channel);
$this->em->flush();
if ($this->view->request->getParameter('setcookie')) {
$this->setCookie($channel);
}
return $channel;
}
}

View file

@ -87,40 +87,6 @@ class EntityController extends Controller {
return $entity;
}
/**
* Adds an entity to the uuids cookie
*
* @todo add to Model\Entity?
* @param Model\Entity $entity
*/
protected function setCookie(Model\Entity $entity) {
$uuids = ($uuids = $this->view->request->getParameter('vz_uuids', 'cookies')) ? explode(';', $uuids) : array();
// add new UUID
$uuids[] = $entity->getUuid();
// send new cookie to browser
setcookie('vz_uuids', implode(';', array_unique($uuids)), 0, '/'); // TODO correct path
}
/**
* Removes an entity from the uuids cookie
*
* @param Model\Entity $entity
* @todo add to Model\Entity?
*/
protected function unsetCookie(Model\Entity $entity) {
$uuids = ($uuids = $this->view->request->getParameter('vz_uuids', 'cookies')) ? explode(';', $uuids) : array();
// remove old UUID
$uuids = array_filter($uuids, function($uuid) use ($entity) {
return $uuid != $entity->getUuid();
});
// send new cookie to browser
setcookie('vz_uuids', implode(';', array_unique($uuids)), 0, '/'); // TODO correct path
}
/**
* Update/set/delete properties of entities
*/