Error deleting a field that was created through a migration
Open
@andris-sevcenko is already working on this.
Since Mar 19, 2020.
- Dominant language
- PHP
- Stars
- 3.6k
- Forks
- 705
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 134
Description
Description
When trying to delete field I created through a migration, the following error is thrown:
Argument 2 passed to craft\services\Fields::applyFieldSave() must be of the type array, null given, called in /Users/jhenckens/Sites/vigwec3/vendor/craftcms/cms/src/services/Fields.php on line 826
When I try to validate the field no errors are shown and I can use it like any other field.
I'm creating the field like this:
$latitude = new PlainText();
$latitude->handle = 'latitude';
$latitude->name = 'Latitude';
$latitude->groupId = 2;
Craft::$app->getFields()->saveField($latitude);
Deleting a field that was created through the CP works.
Steps to reproduce
- Create a field through a migration
- Try to delete that same field
Additional info
- Craft version: 3.4.9
- PHP version: 7.3.
- Database driver & version: 5.7.26
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.