From af131cb513584a2bbc992dfcaa756a5b425dbe50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Wed, 14 Dec 2016 10:11:33 +0100 Subject: Added index on table creation --- src/Wallabag/CoreBundle/Entity/Entry.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index 3ae5334f..8dcc7190 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -22,7 +22,8 @@ use Wallabag\AnnotationBundle\Entity\Annotation; * @ORM\Table( * name="`entry`", * options={"collate"="utf8mb4_unicode_ci", "charset"="utf8mb4"}, - * indexes={@ORM\Index(name="created_at", columns={"created_at"})} + * indexes={@ORM\Index(name="created_at", columns={"created_at"})}, + * indexes={@ORM\Index(name="uuid", columns={"uuid"})} * ) * @ORM\HasLifecycleCallbacks() * @Hateoas\Relation("self", href = "expr('/api/entries/' ~ object.getId())") -- cgit v1.2.3 From 8137515171a9b3c8e7c3720958acfdccb96803f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Sun, 18 Dec 2016 14:09:56 +0100 Subject: Fixed index on entry.uuid and changed uuid field type --- src/Wallabag/CoreBundle/Controller/EntryController.php | 3 +++ src/Wallabag/CoreBundle/Entity/Entry.php | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index b03f49ed..83148671 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -355,6 +355,9 @@ class EntryController extends Controller { $this->checkUserAction($entry); + $version = $this->getDoctrine()->getManager()->getConnection()->query('SELECT version();')->fetchColumn(); + var_dump($version); + return $this->render( 'WallabagCoreBundle:Entry:entry.html.twig', ['entry' => $entry] diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index 8dcc7190..4c22cf9c 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -22,8 +22,10 @@ use Wallabag\AnnotationBundle\Entity\Annotation; * @ORM\Table( * name="`entry`", * options={"collate"="utf8mb4_unicode_ci", "charset"="utf8mb4"}, - * indexes={@ORM\Index(name="created_at", columns={"created_at"})}, - * indexes={@ORM\Index(name="uuid", columns={"uuid"})} + * indexes={ + * @ORM\Index(name="created_at", columns={"created_at"}), + * @ORM\Index(name="uuid", columns={"uuid"}) + * } * ) * @ORM\HasLifecycleCallbacks() * @Hateoas\Relation("self", href = "expr('/api/entries/' ~ object.getId())") @@ -45,7 +47,7 @@ class Entry /** * @var string * - * @ORM\Column(name="uuid", type="text", nullable=true) + * @ORM\Column(name="uuid", type="guid", nullable=true) * * @Groups({"entries_for_user", "export_all"}) */ -- cgit v1.2.3 From 89cd670abfc77ca268a538c9323a4026fec06fc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 23 Dec 2016 09:49:22 +0100 Subject: Changed uuid type in database --- src/Wallabag/CoreBundle/Controller/EntryController.php | 3 --- src/Wallabag/CoreBundle/Entity/Entry.php | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) (limited to 'src') diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 83148671..b03f49ed 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -355,9 +355,6 @@ class EntryController extends Controller { $this->checkUserAction($entry); - $version = $this->getDoctrine()->getManager()->getConnection()->query('SELECT version();')->fetchColumn(); - var_dump($version); - return $this->render( 'WallabagCoreBundle:Entry:entry.html.twig', ['entry' => $entry] diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index 4c22cf9c..4c9d518f 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -47,7 +47,7 @@ class Entry /** * @var string * - * @ORM\Column(name="uuid", type="guid", nullable=true) + * @ORM\Column(name="uuid", type="string", length=23, nullable=true) * * @Groups({"entries_for_user", "export_all"}) */ -- cgit v1.2.3 From 7239082a5e290dada1d393f7a25acebb09ace2de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Thu, 29 Dec 2016 10:09:44 +0100 Subject: Renamed uuid to uid --- .../CoreBundle/Controller/EntryController.php | 10 ++++----- src/Wallabag/CoreBundle/Entity/Entry.php | 26 +++++++++++----------- 2 files changed, 18 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index b03f49ed..f7398e69 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -539,8 +539,8 @@ class EntryController extends Controller { $this->checkUserAction($entry); - if (null === $entry->getUuid()) { - $entry->generateUuid(); + if (null === $entry->getUid()) { + $entry->generateUid(); $em = $this->getDoctrine()->getManager(); $em->persist($entry); @@ -548,7 +548,7 @@ class EntryController extends Controller } return $this->redirect($this->generateUrl('share_entry', [ - 'uuid' => $entry->getUuid(), + 'uid' => $entry->getUid(), ])); } @@ -565,7 +565,7 @@ class EntryController extends Controller { $this->checkUserAction($entry); - $entry->cleanUuid(); + $entry->cleanUid(); $em = $this->getDoctrine()->getManager(); $em->persist($entry); @@ -581,7 +581,7 @@ class EntryController extends Controller * * @param Entry $entry * - * @Route("/share/{uuid}", requirements={"uuid" = ".+"}, name="share_entry") + * @Route("/share/{uid}", requirements={"uid" = ".+"}, name="share_entry") * @Cache(maxage="25200", smaxage="25200", public=true) * * @return \Symfony\Component\HttpFoundation\Response diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index 4c9d518f..7276b437 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -24,7 +24,7 @@ use Wallabag\AnnotationBundle\Entity\Annotation; * options={"collate"="utf8mb4_unicode_ci", "charset"="utf8mb4"}, * indexes={ * @ORM\Index(name="created_at", columns={"created_at"}), - * @ORM\Index(name="uuid", columns={"uuid"}) + * @ORM\Index(name="uid", columns={"uid"}) * } * ) * @ORM\HasLifecycleCallbacks() @@ -47,11 +47,11 @@ class Entry /** * @var string * - * @ORM\Column(name="uuid", type="string", length=23, nullable=true) + * @ORM\Column(name="uid", type="string", length=23, nullable=true) * * @Groups({"entries_for_user", "export_all"}) */ - private $uuid; + private $uid; /** * @var string @@ -652,34 +652,34 @@ class Entry /** * @return string */ - public function getUuid() + public function getUid() { - return $this->uuid; + return $this->uid; } /** - * @param string $uuid + * @param string $uid * * @return Entry */ - public function setUuid($uuid) + public function setUid($uid) { - $this->uuid = $uuid; + $this->uid = $uid; return $this; } - public function generateUuid() + public function generateUid() { - if (null === $this->uuid) { + if (null === $this->uid) { // @see http://blog.kevingomez.fr/til/2015/07/26/why-is-uniqid-slow/ for true parameter - $this->uuid = uniqid('', true); + $this->uid = uniqid('', true); } } - public function cleanUuid() + public function cleanUid() { - $this->uuid = null; + $this->uid = null; } /** -- cgit v1.2.3