aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Wallabag/CoreBundle/Entity/Entry.php36
-rw-r--r--src/Wallabag/CoreBundle/Helper/ContentProxy.php1
-rw-r--r--src/Wallabag/CoreBundle/Repository/EntryRepository.php1
3 files changed, 37 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php
index 1b4367fd..62274136 100644
--- a/src/Wallabag/CoreBundle/Entity/Entry.php
+++ b/src/Wallabag/CoreBundle/Entity/Entry.php
@@ -28,7 +28,8 @@ use Wallabag\UserBundle\Entity\User;
28 * @ORM\Index(name="created_at", columns={"created_at"}), 28 * @ORM\Index(name="created_at", columns={"created_at"}),
29 * @ORM\Index(name="uid", columns={"uid"}), 29 * @ORM\Index(name="uid", columns={"uid"}),
30 * @ORM\Index(name="hashed_url_user_id", columns={"user_id", "hashed_url"}, options={"lengths"={null, 40}}) 30 * @ORM\Index(name="hashed_url_user_id", columns={"user_id", "hashed_url"}, options={"lengths"={null, 40}})
31 * } 31 * },
32 * uniqueConstraints={@ORM\UniqueConstraint(name="IDX_entry_given_url",columns={"url", "given_url", "user_id"})}
32 * ) 33 * )
33 * @ORM\HasLifecycleCallbacks() 34 * @ORM\HasLifecycleCallbacks()
34 * @Hateoas\Relation("self", href = "expr('/api/entries/' ~ object.getId())") 35 * @Hateoas\Relation("self", href = "expr('/api/entries/' ~ object.getId())")
@@ -70,6 +71,15 @@ class Entry
70 /** 71 /**
71 * @var string 72 * @var string
72 * 73 *
74 * @ORM\Column(name="given_url", type="text", nullable=true)
75 *
76 * @Groups({"entries_for_user", "export_all"})
77 */
78 private $givenUrl;
79
80 /**
81 * @var string
82 *
73 * @Assert\NotBlank() 83 * @Assert\NotBlank()
74 * @ORM\Column(name="url", type="text", nullable=true) 84 * @ORM\Column(name="url", type="text", nullable=true)
75 * 85 *
@@ -316,6 +326,30 @@ class Entry
316 } 326 }
317 327
318 /** 328 /**
329 * Set given url.
330 *
331 * @param string $givenUrl
332 *
333 * @return Entry
334 */
335 public function setGivenUrl($givenUrl)
336 {
337 $this->givenUrl = $givenUrl;
338
339 return $this;
340 }
341
342 /**
343 * Get given Url.
344 *
345 * @return string
346 */
347 public function getGivenUrl()
348 {
349 return $this->givenUrl;
350 }
351
352 /**
319 * Set url. 353 * Set url.
320 * 354 *
321 * @param string $url 355 * @param string $url
diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php
index c6fa0d98..0d6a412d 100644
--- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php
+++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php
@@ -76,6 +76,7 @@ class ContentProxy
76 // Not sure what are the other possible cases where this property is empty 76 // Not sure what are the other possible cases where this property is empty
77 if (empty($entry->getUrl()) && !empty($url)) { 77 if (empty($entry->getUrl()) && !empty($url)) {
78 $entry->setUrl($url); 78 $entry->setUrl($url);
79 $entry->setGivenUrl($url);
79 } 80 }
80 81
81 $this->stockEntry($entry, $content); 82 $this->stockEntry($entry, $content);
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
index 880e7c65..299b0b27 100644
--- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php
+++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
@@ -368,6 +368,7 @@ class EntryRepository extends EntityRepository
368 { 368 {
369 $res = $this->createQueryBuilder('e') 369 $res = $this->createQueryBuilder('e')
370 ->where('e.hashedUrl = :hashed_url')->setParameter('hashed_url', $hashedUrl) 370 ->where('e.hashedUrl = :hashed_url')->setParameter('hashed_url', $hashedUrl)
371 // ->orWhere('e.givenUrl = :url')->setParameter('url', $url)
371 ->andWhere('e.user = :user_id')->setParameter('user_id', $userId) 372 ->andWhere('e.user = :user_id')->setParameter('user_id', $userId)
372 ->getQuery() 373 ->getQuery()
373 ->getResult(); 374 ->getResult();