From f5dc25f0c560037b3056184905ee7f665da8d65f Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Tue, 11 Jun 2019 15:32:16 +0200 Subject: [PATCH] #2810 --- src/app/Console/Commands/CubistCommand.php | 1 + src/app/Magic/Models/CubistMagicAbstractModel.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/Console/Commands/CubistCommand.php b/src/app/Console/Commands/CubistCommand.php index 455b40c..8a507bd 100644 --- a/src/app/Console/Commands/CubistCommand.php +++ b/src/app/Console/Commands/CubistCommand.php @@ -77,6 +77,7 @@ class CubistCommand extends Command } } } catch (\Exception $e) { + $this->line($e->getMessage()); } } } diff --git a/src/app/Magic/Models/CubistMagicAbstractModel.php b/src/app/Magic/Models/CubistMagicAbstractModel.php index c9b4394..67ab9a4 100644 --- a/src/app/Magic/Models/CubistMagicAbstractModel.php +++ b/src/app/Magic/Models/CubistMagicAbstractModel.php @@ -174,7 +174,7 @@ class CubistMagicAbstractModel extends Model { /** @var Field $field */ $field = Field::getInstance($attributes); - if (null !== $field->getRelationship()) { + if (is_callable([$field, 'getRelationship']) && null !== $field->getRelationship()) { $this->_addRelationship($field); } @@ -390,7 +390,7 @@ class CubistMagicAbstractModel extends Model $foreignEntity = self::_toModel($field->getAttribute('model')); if ($field->getRelationship() == 'belongsToMany') { - return 'rel_btm_' . $foreignEntity->table . '_' . $this->table; + return $this->getTable() . '_' . $field->getAttribute('name') . '_rel_btm'; } } -- 2.39.5