Closed DavidKabelitz closed 5 months ago
Are you sure this is still on Craft 4.8.9? If it's trying to call craft\fields\Entries::getBlockTypes()
that makes me think that the certification of a Matrix field has already happened. It should be impossible that to occur.
More to the point, it's looking at the matrixblocktypes
database table, and the fieldId
and that references an Entries field, where it should reference a Matrix field - never anything else.
Is it possible something might've gotten mixed up in your project?
Yes it's 4.8.9 and also the only project with this problem. Migrated already some others. What do you mean with mixed up?
Had the same problem, but with a superTable field.
Log stack:
Preparing to migrate field “headerLink” (e744d709-31b6-4e1b-826a-67cc9bda50ac).
Exception: Calling unknown method: craft\fields\Entries::getBlockTypes() (/Users/jorn/Sites/website-craft/vendor/yiisoft/yii2/base/Component.php:300)
#0 /Users/jorn/Sites/website-craft/vendor/verbb/hyper/src/migrations/MigrateTypedLinkField.php(213): yii\base\Component->__call('getBlockTypes', Array)
#1 /Users/jorn/Sites/website-craft/vendor/verbb/hyper/src/migrations/MigrateTypedLinkField.php(184): verbb\hyper\migrations\MigrateTypedLinkField->migrateBlockField(Object(craft\fields\Entries), Object(verbb\hyper\fields\HyperField))
#2 /Users/jorn/Sites/website-craft/vendor/verbb/hyper/src/migrations/PluginFieldMigration.php(46): verbb\hyper\migrations\MigrateTypedLinkField->processFieldSettings()
#3 /Users/jorn/Sites/website-craft/vendor/craftcms/cms/src/db/Migration.php(49): verbb\hyper\migrations\PluginFieldMigration->safeUp()
#4 /Users/jorn/Sites/website-craft/vendor/verbb/hyper/src/console/controllers/MigrateController.php(69): craft\db\Migration->up()
#5 /Users/jorn/Sites/website-craft/vendor/verbb/hyper/src/console/controllers/MigrateController.php(35): verbb\hyper\console\controllers\MigrateController->_migrate('verbb\\hyper\\mig...')
#6 [internal function]: verbb\hyper\console\controllers\MigrateController->actionTypedLinkField()
#7 /Users/jorn/Sites/website-craft/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#8 /Users/jorn/Sites/website-craft/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#9 /Users/jorn/Sites/website-craft/vendor/yiisoft/yii2/console/Controller.php(180): yii\base\Controller->runAction('typed-link-fiel...', Array)
#10 /Users/jorn/Sites/website-craft/vendor/yiisoft/yii2/base/Module.php(552): yii\console\Controller->runAction('typed-link-fiel...', Array)
#11 /Users/jorn/Sites/website-craft/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('hyper/migrate/t...', Array)
#12 /Users/jorn/Sites/website-craft/vendor/craftcms/cms/src/console/Application.php(91): yii\console\Application->runAction('hyper/migrate/t...', Array)
#13 /Users/jorn/Sites/website-craft/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('hyper/migrate/t...', Array)
#14 /Users/jorn/Sites/website-craft/vendor/craftcms/cms/src/console/Application.php(122): yii\console\Application->handleRequest(Object(craft\console\Request))
#15 /Users/jorn/Sites/website-craft/vendor/yiisoft/yii2/base/Application.php(384): craft\console\Application->handleRequest(Object(craft\console\Request))
#16 /Users/jorn/Sites/website-craft/craft(13): yii\base\Application->run()
#17 {main}
In my case, I found out that there was a field in the superTableBlockType table that wasn't a superTable anymore. It probably was superTable once, but after some time changed in to something else...
Or maybe it was a link field in a superTable, then the parent superTable field got changed into something else, leaving the link field behind in the fields table.. I don't know for sure.
Removing the field from the fields table, and superTableBlockType table fixed the problem.
The problem is caused because of the variable on line 179: https://github.com/verbb/hyper/blob/craft-4/src/migrations/MigrateTypedLinkField.php#L179 isn't actually a superTable. Maybe a check if the field type is actually superTable here will prevent errors.
Yeah with also have some Link Fields inside a Super Table
Yeah, we'll introduce some checks here for the field type. I'm surprised we need them, but better to be safe!
It's possible there's maybe multiple fields of different types with the same handle? That being uspLink
for @DavidKabelitz and headerLink
for @jornwildenbeest would that be possible?
Fixed for the next release. To get this early run composer require verbb/hyper:"dev-craft-4 as 1.1.27"
@engram-design multiple fields of different types with the same handle.. Hmm well not directly because Craft doesn't allow that.
Maybe there was headerLink
field, and then someone created another headerLink
field inside a superTable.. that could be possible, and since we are working with a team on this project I'm afraid I'm not sure what or how this happend.
I will give the next release a try!
@engram-design if you are talking about using the same handle at different supertable fields, yes we do that. But just with supertable fields.
In other cases we reuse the same field with e.g. neo.
Update worked for me, just got some different errors after it. "Field Origin not found"...changed those manually to hyper. Content migration worked so far. Thx for the fix
Describe the bug
First step of migration throws that error:
`Preparing to migrate field “uspLink” (f4b9ca73-e4a0-4a89-b42d-612b8632c443). Exception: Calling unknown method: craft\fields\Entries::getBlockTypes() (/var/www/craft/vendor/yiisoft/yii2/base/Component.php:300)
0 /var/www/craft/vendor/verbb/hyper/src/migrations/MigrateTypedLinkField.php(211): yii\base\Component->__call('getBlockTypes', Array)
1 /var/www/craft/vendor/verbb/hyper/src/migrations/MigrateTypedLinkField.php(182): verbb\hyper\migrations\MigrateTypedLinkField->migrateBlockField(Object(craft\fields\Entries), Object(verbb\hyper\fields\HyperField))
2 /var/www/craft/vendor/verbb/hyper/src/migrations/PluginFieldMigration.php(46): verbb\hyper\migrations\MigrateTypedLinkField->processFieldSettings()
3 /var/www/craft/vendor/craftcms/cms/src/db/Migration.php(49): verbb\hyper\migrations\PluginFieldMigration->safeUp()
4 /var/www/craft/vendor/verbb/hyper/src/controllers/MigrationsController.php(71): craft\db\Migration->up()
5 /var/www/craft/vendor/verbb/hyper/src/controllers/MigrationsController.php(35): verbb\hyper\controllers\MigrationsController->_migrate('verbb\hyper\mig...')
6 [internal function]: verbb\hyper\controllers\MigrationsController->actionTypedLinkField()
7 /var/www/craft/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
8 /var/www/craft/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
9 /var/www/craft/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('typed-link-fiel...', Array)
10 /var/www/craft/vendor/craftcms/cms/src/web/Application.php(341): yii\base\Module->runAction('hyper/migration...', Array)
11 /var/www/craft/vendor/craftcms/cms/src/web/Application.php(642): craft\web\Application->runAction('hyper/migration...', Array)
12 /var/www/craft/vendor/craftcms/cms/src/web/Application.php(303): craft\web\Application->_processActionRequest(Object(craft\web\Request))
13 /var/www/craft/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
14 /var/www/craft/web/index.php(26): yii\base\Application->run()
15 {main}`
Steps to reproduce
Craft CMS version
4.8.9
Plugin version
1.1.27
Multi-site?
Yes
Additional context
No response