diff --git a/app/db/migrations/20240624022427_create_images_table.php b/app/db/migrations/20240624022427_create_images_table.php new file mode 100644 index 0000000..2ee9715 --- /dev/null +++ b/app/db/migrations/20240624022427_create_images_table.php @@ -0,0 +1,49 @@ +table('images')->addTimestamps(); + $table->addColumn('url', 'string') + ->addColumn('title', 'string', [ 'null' => false ]) + ->addColumn('width', 'integer', [ + 'null' => true, + 'signed' => false, + ]) + ->addColumn('height', 'integer', [ + 'null' => true, + 'signed' => false + ]) + ->addIndex([ 'url' ], [ 'type' => 'unique' ]) + ->create(); + } +} diff --git a/app/public/static/main.css b/app/public/static/main.css index 55c3730..c1c9a98 100644 --- a/app/public/static/main.css +++ b/app/public/static/main.css @@ -41,6 +41,12 @@ main { box-sizing: border-box; } +.error { + padding: 0.5em; + border: 1px solid #140505; + background-color: #C32727; +} + footer { text-align: right; padding: 0.25em 1em; diff --git a/app/src/Domain/Repository/Channel/ChannelRepository.php b/app/src/Domain/Repository/Channel/ChannelRepository.php index cb719be..82b1f81 100644 --- a/app/src/Domain/Repository/Channel/ChannelRepository.php +++ b/app/src/Domain/Repository/Channel/ChannelRepository.php @@ -52,7 +52,7 @@ class ChannelRepository implements ChannelRepositoryInterface $statement->execute([ ':id' => $id ]); $results = $statement->fetch(\PDO::FETCH_ASSOC); - if (!count($results)) { + if (!is_array($results) || !count($results)) { throw new EntityNotFoundException("Unable to find Channel"); } @@ -70,7 +70,7 @@ class ChannelRepository implements ChannelRepositoryInterface $statement->execute([ ':id' => $user->getId() ]); $results = $statement->fetch(\PDO::FETCH_ASSOC); - if (!count($results)) { + if (!is_array($results) || !count($results)) { throw new EntityNotFoundException("Unable to find Channel"); } @@ -88,7 +88,7 @@ class ChannelRepository implements ChannelRepositoryInterface $statement->execute([ ':slug' => $slug ]); $results = $statement->fetch(\PDO::FETCH_ASSOC); - if (!count($results)) { + if (!is_array($results) || !count($results)) { throw new EntityNotFoundException("Unable to find Channel"); } diff --git a/dev/php/migrations.sh b/dev/php/migrations.sh new file mode 100644 index 0000000..865ebe3 --- /dev/null +++ b/dev/php/migrations.sh @@ -0,0 +1,3 @@ +#!/usr/bin/bash + +composer run phinx migrate -e development