Fixed edit short code action not being properly registered

This commit is contained in:
Alejandro Celaya 2018-01-07 21:13:06 +01:00
parent ecebdbbfa8
commit ce9d6642d4
2 changed files with 4 additions and 3 deletions

View file

@ -7,7 +7,6 @@ use Cocur\Slugify\Slugify;
use Cocur\Slugify\SlugifyInterface;
use Doctrine\Common\Cache\Cache;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\ORMException;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\GuzzleException;
use Psr\Http\Message\UriInterface;
@ -119,14 +118,14 @@ class UrlShortener implements UrlShortenerInterface
$this->em->flush();
// Generate the short code and persist it
$shortCode = $customSlug ?? $this->convertAutoincrementIdToShortCode($shortUrl->getId());
$shortCode = $customSlug ?? $this->convertAutoincrementIdToShortCode((float) $shortUrl->getId());
$shortUrl->setShortCode($shortCode)
->setTags($this->tagNamesToEntities($this->em, $tags));
$this->em->flush();
$this->em->commit();
return $shortCode;
} catch (ORMException $e) {
} catch (\Throwable $e) {
if ($this->em->getConnection()->isTransactionActive()) {
$this->em->rollback();
$this->em->close();

View file

@ -21,6 +21,7 @@ return [
Action\AuthenticateAction::class => ConfigAbstractFactory::class,
Action\CreateShortcodeAction::class => ConfigAbstractFactory::class,
Action\EditShortCodeAction::class => ConfigAbstractFactory::class,
Action\ResolveUrlAction::class => ConfigAbstractFactory::class,
Action\GetVisitsAction::class => ConfigAbstractFactory::class,
Action\ListShortcodesAction::class => ConfigAbstractFactory::class,
@ -48,6 +49,7 @@ return [
'config.url_shortener.domain',
'Logger_Shlink',
],
Action\EditShortCodeAction::class => [Service\ShortUrlService::class, 'translator', 'Logger_Shlink',],
Action\ResolveUrlAction::class => [Service\UrlShortener::class, 'translator'],
Action\GetVisitsAction::class => [Service\VisitsTracker::class, 'translator', 'Logger_Shlink'],
Action\ListShortcodesAction::class => [Service\ShortUrlService::class, 'translator', 'Logger_Shlink'],