-
Notifications
You must be signed in to change notification settings - Fork 107
Open
Description
Using
"franzose/closure-table": "^6.1",
"laravel/framework": "^6.2",
When using demo code from https://github.com/franzose/ClosureTable#tree
class SubjectsTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Subject::createFromArray([
'id' => 1,
'children' => [
[
'id' => 2,
'children' => [
[
'id' => 3,
'children' => [
[
'id' => 4,
'children' => [
[
'id' => 5,
'children' => [
[
'id' => 6,
]
]
]
]
]
]
]
]
]
]
]);
}
Running the seeder results in this error
In Entity.php line 116:
Argument 1 passed to Franzose\ClosureTable\Models\Entity::__construct() must be of the type array, int given, called in /home/vagrant/code/ripm_lill_laravel/vendor/franzose/closure-table/src/Models/Entity.php on line 1770
After adding another level of nesting as suggested in #239
Subject::createFromArray([
[
'id' => 1,
'children' => [
[
'id' => 2,
'children' => [
[
'id' => 3,
'children' => [
[
'id' => 4,
'children' => [
[
'id' => 5,
'children' => [
[
'id' => 6,
]
]
]
]
]
]
]
]
]
]
]
]);
I get the error
In Str.php line 419:
Array to string conversion
I believe this issue is related to the nested children. Removing any 'children' results in a successful migration.
Subject::createFromArray([
['id' => 200],
['id' => 300],
['id' => 400],
['id' => 500],
]);
Metadata
Metadata
Assignees
Labels
No labels