Use the generic slug generation also for repeating events.

Fixes #20
This commit is contained in:
Tim Schumacher 2014-09-23 18:57:34 +02:00
parent 3a68ee4bcf
commit 73400e90fd

View file

@ -191,10 +191,12 @@ class RepeatingEventController extends Controller
$location = $request->get('location');
$location_lat = $request->get('location_lat');
$location_lon = $request->get('location_lon');
/** @var EntityManager $em */
$em = $this->getDoctrine()->getManager();
if (strlen($location) > 0) {
// check if the location already exists
/** @var EntityManager $em */
$em = $this->getDoctrine()->getManager();
$repo = $em->getRepository('CalciferBundle:Location');
$results = $repo->findBy(['name' => $location]);
if (count($results) > 0) {
@ -217,7 +219,7 @@ class RepeatingEventController extends Controller
if (strlen($location_lon) > 0) {
$location_obj->lon = $location_lon;
}
$location_obj->slug = \URLify::filter($location_obj->name, 255, 'de');
$location_obj->slug = $location_obj->generateSlug($location_obj->name,$em);
$em->persist($location_obj);
$em->flush();
$entity->location = $location_obj;
@ -240,7 +242,7 @@ class RepeatingEventController extends Controller
} else {
$tag_obj = new Tag();
$tag_obj->name = $tag;
$tag_obj->slug = \URLify::filter($tag_obj->name, 255, 'de');
$tag_obj->slug = $tag_obj->generateSlug($tag_obj->name,$em);
$em->persist($tag_obj);
$em->flush();
$entity->addTag($tag_obj);
@ -250,7 +252,7 @@ class RepeatingEventController extends Controller
$entity->clearTags();
}
$entity->slug = \URLify::filter($entity->summary,255,'de');
$entity->slug = $entity->generateSlug($entity->summary,$em);
$em = $this->getDoctrine()->getManager();
$em->persist($entity);