diff --git a/app/views/collection/edit.php b/app/views/collection/edit.php
index 74e6605a..516858f0 100644
--- a/app/views/collection/edit.php
+++ b/app/views/collection/edit.php
@@ -14,13 +14,13 @@
|
-
+
|
- |
+ |
-
+
|
@@ -28,7 +28,7 @@
|
diff --git a/src/Model/AnimeCollection.php b/src/Model/AnimeCollection.php
index 0c1deb37..ea42e848 100644
--- a/src/Model/AnimeCollection.php
+++ b/src/Model/AnimeCollection.php
@@ -89,21 +89,6 @@ final class AnimeCollection extends Collection {
return $output;
}
- /**
- * Get item from collection for editing
- *
- * @param string $id
- * @return array
- */
- public function getCollectionEntry($id): array
- {
- $query = $this->db->from('anime_set')
- ->where('hummingbird_id', $id)
- ->get();
-
- return $query->fetch(PDO::FETCH_ASSOC);
- }
-
/**
* Get full collection from the database
*
@@ -151,7 +136,16 @@ final class AnimeCollection extends Collection {
*/
public function add($data): void
{
- $anime = (object)$this->animeModel->getAnimeById($data['id']);
+ $id = $data['id'];
+
+ // Check that the anime doesn't already exist
+ $existing = $this->get($id);
+ if ($existing === FALSE)
+ {
+ return;
+ }
+
+ $anime = (object)$this->animeModel->getAnimeById($id);
$this->db->set([
'hummingbird_id' => $data['id'],
'slug' => $anime->slug,
@@ -216,9 +210,9 @@ final class AnimeCollection extends Collection {
* Get the details of a collection item
*
* @param int $kitsuId
- * @return array
+ * @return array | false
*/
- public function get($kitsuId): array
+ public function get($kitsuId)
{
$query = $this->db->from('anime_set')
->where('hummingbird_id', $kitsuId)
diff --git a/src/Model/Collection.php b/src/Model/Collection.php
index 008b1556..44a33e4f 100644
--- a/src/Model/Collection.php
+++ b/src/Model/Collection.php
@@ -17,7 +17,6 @@
namespace Aviat\AnimeClient\Model;
use Aviat\Ion\Di\ContainerInterface;
-use PDO;
use PDOException;
/**