From: Vincent Vanwaelscappel Date: Tue, 11 Jun 2019 13:32:16 +0000 (+0200) Subject: #2810 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=f5dc25f0c560037b3056184905ee7f665da8d65f;p=cubist_cms-back.git #2810 --- 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'; } }