Skip to content

Commit

Permalink
dependecy upgrades and shortuuid fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mkorkmaz committed Jan 23, 2021
1 parent 782b2fc commit aed7f79
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"laminas/laminas-permissions-rbac": "^3.0.2",
"laminas/laminas-servicemanager": "^3.6.2",
"laminas/laminas-stdlib": "^3.3.1",
"lcobucci/jwt": "^3.4.2",
"lcobucci/jwt": "^4.0.0",
"league/flysystem": "^1.1.3",
"league/tactician": "^2.0-rc1",
"mezzio/mezzio": "^3.2.2",
Expand All @@ -79,12 +79,12 @@
"mezzio/mezzio-problem-details": "^1.2.0",
"mezzio/mezzio-session-ext": "^1.10.0",
"mezzio/mezzio-twigrenderer": "^2.6.1",
"mkorkmaz/redislabs-rejson": "^0.1.2",
"mkorkmaz/redislabs-rejson": "^1.0",
"moneyphp/money": "^v3.3.1",
"monolog/monolog": "^2.2.0",
"nesbot/carbon": "^2.43.0",
"nikolaposa/rate-limit": "^2.2.0",
"ocramius/proxy-manager": "^2.10.1",
"ocramius/proxy-manager": "^2.11",
"phpoffice/phpspreadsheet": "^1.16.0",
"psr/container": "^1.0.0",
"psr/http-message": "^1.0.1",
Expand All @@ -94,7 +94,7 @@
"ralouphie/mimey": "^2.1.0",
"ramsey/uuid": "^4.1.1",
"ramsey/uuid-doctrine": "^1.6.0",
"robinvdvleuten/ulid": "^v4.1.0",
"robinvdvleuten/ulid": "^v5.0.0",
"scienta/doctrine-json-functions": "^4.3.0",
"selami/console": "^2.1",
"selami/stdlib": "^2.0",
Expand All @@ -104,7 +104,7 @@
},
"require-dev": {
"behat/behat": "^v3.8.1",
"doctrine/coding-standard": "^6.0.1",
"doctrine/coding-standard": "^8.2.0",
"filp/whoops": "^2.9.1",
"laminas/laminas-development-mode": "^3.3.0",
"malukenho/mcbumpface": "^1.1.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
use DateTimeZone;
use Doctrine\DBAL\Driver\Connection;
use Doctrine\ORM\EntityManager;
use Keiko\Uuid\Shortener\Dictionary;
use Keiko\Uuid\Shortener\Shortener;
use PascalDeVink\ShortUuid\ShortUuid;
use Ramsey\Uuid\Uuid;
use Redislabs\Module\ReJSON\ReJSON;
use const DATE_ATOM;
use const JSON_THROW_ON_ERROR;
Expand Down Expand Up @@ -183,9 +183,8 @@ public function getContentBySlugForClient(string $slug) : array
public function getContentsByCategory(string $category, ?bool $withBody = false) : array
{
$slugify = new Slugify(['rulesets' => ['default', 'turkish']]);
$shortener = Shortener::make(
Dictionary::createUnmistakable() // or pass your own characters set
);
$shortener = new ShortUuid();

$returnData = [];
$withBodySql = '';
$sql = '
Expand Down Expand Up @@ -221,7 +220,7 @@ public function getContentsByCategory(string $category, ?bool $withBody = false)
foreach ($data as $datum) {
$datum['images'] = json_decode($datum['images'], true, 512, JSON_THROW_ON_ERROR);
$datum['metadata'] = json_decode($datum['metadata'], true, 512, JSON_THROW_ON_ERROR);
$datum['slug'] = $datum['category_slug'] . '/' . $slugify->slugify($datum['title']) . '-' . $shortener->reduce($datum['id']);
$datum['slug'] = $datum['category_slug'] . '/' . $slugify->slugify($datum['title']) . '-' . $shortener->encode(Uuid::fromString($datum['id']));

$returnData[] = $datum;
}
Expand Down Expand Up @@ -299,7 +298,7 @@ public function getContentsByCategoryForClient(string $category, int $offset, in
$datum['heroImage'] = '';
$datum['publishDate'] = new CarbonImmutable($datum['created_at'], 'UTC');
$datum['publishDate'] = $datum['publishDate']->setTimezone(new DateTimeZone('europe/istanbul'))
->format('d.m.Y');
->format('d.m.Y');
if (array_key_exists('publishDate', $datum['metadata'])) {
$datum['publishDate'] = new CarbonImmutable($datum['metadata']['publishDate']);
$datum['publishDate'] = $datum['publishDate']->format('d.m.Y');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

use BackendBase\Infrastructure\Persistence\Doctrine\Repository\ContentRepository;
use BackendBase\Shared\Services\MessageBus\Interfaces\QueryBus;
use Keiko\Uuid\Shortener\Dictionary;
use Keiko\Uuid\Shortener\Shortener;
use PascalDeVink\ShortUuid\ShortUuid;
use Laminas\Diactoros\Response\HtmlResponse;
use Mezzio\Csrf\CsrfMiddleware;
use Mezzio\Template\TemplateRendererInterface;
Expand Down Expand Up @@ -41,9 +40,7 @@ public function handle(ServerRequestInterface $request) : ResponseInterface
$token = $guard->generateToken();
$pageSlug = $request->getAttribute('pageSlug');

$shortener = Shortener::make(
Dictionary::createUnmistakable() // or pass your own characters set
);
$shortener = new ShortUuid();
$page = $this->contentRepository->getContentBySlugForClient($pageSlug);

$data = ['page' => $page];
Expand Down

0 comments on commit aed7f79

Please sign in to comment.