Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix critical errors #43

Merged
merged 1 commit into from
Apr 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use InvalidArgumentException;
use PDO;
use PDOStatement;
use RuntimeException;
use SimpleCrud\Fields\Boolean;
use SimpleCrud\Fields\Date;
use SimpleCrud\Fields\Datetime;
Expand Down Expand Up @@ -219,7 +220,7 @@ public function executeTransaction(callable $callable)
$this->commit();
}
} catch (Exception $exception) {
if ($transaction) {
if (isset($transaction) && $transaction) {
$this->rollBack();
}

Expand Down
1 change: 1 addition & 0 deletions src/EventDispatcher/Dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
namespace SimpleCrud\EventDispatcher;

use Psr\EventDispatcher\EventDispatcherInterface;
use Psr\EventDispatcher\ListenerProviderInterface;

class Dispatcher implements EventDispatcherInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Fields/Serializable.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function format($value)
return @unserialize($value, $this->config['unserialize']) ?: [];
}

protected function formatToDatabase($value): string
protected function formatToDatabase($value): ?string
{
if ($value === null) {
return $value;
Expand Down
2 changes: 1 addition & 1 deletion src/Queries/SelectAggregate.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct(Table $table, string $function, string $field = 'id'
$function = strtoupper($function);

if (!in_array($function, self::AGGREGATION_FUNCTIONS)) {
throw InvalidArgumentException(
throw new InvalidArgumentException(
sprintf('Invalid aggregation function. Must be one of the followings: %s', implode(', ', self::AGGREGATION_FUNCTIONS))
);
}
Expand Down
3 changes: 1 addition & 2 deletions src/Queries/Traits/HasRelatedWith.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
trait HasRelatedWith
{
/**
* @param Row|RowCollection|Table
* @param mixed $related
* @param Row|RowCollection|Table $related
*/
public function relatedWith($related): self
{
Expand Down