craft-linkfield: error: Class 'typedlinkfield\fields\LinkField' not found

I just migrated to another server and updated some dependencies. When running /.craft project-config/apply I get the following error: error: Class 'typedlinkfield\fields\LinkField' not found

Does that tell you anything? I am a bit lost how to debug that…

Thanks for any help. Cheers

"require": {
    "php": "7.0.* || 7.1.* || 7.2.*",
    "craftcms/cms": "^3.5.2",
    "craftcms/element-api": "2.6.0",
    "craftcms/redactor": "2.6.0.1",
    "mmikkel/cp-field-inspect": "1.1.2",
    "nystudio107/craft-seomatic": "^3.2.43",
    "putyourlightson/craft-cp-style-guide": "1.0.2",
    "sebastianlenz/linkfield": "2.0.x-dev",
    "spicyweb/craft-neo": "^2.6.1",
    "verbb/field-manager": "2.1.1",
    "vlucas/phpdotenv": "^2.4.0"
  },

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 50 (16 by maintainers)

Commits related to this issue

Most upvoted comments

Ok - I am back with some information:

I managed to solve the deprecation error in my project. Here is what I did:

  • I went back and started checking every link field that I had
  • Found out that in 2 places the fields had wrong field type. They were - to my surprise - shown as assets and not as link fields
  • I switched back to link field type, adjusted the settings accordingly
  • When I removed the deprecation warning and reloaded the page - deprecation was gone, no errors

Now as to why the link fields were shown as assets - I have no idea what could’ve gone wrong at this point.

I migrated to Craft 4 about a month ago but for the life of me I cannot recall if that deprecation error was present since then or is it more recent…

P.S. I took the liberty of tagging people who recently encountered this issue - hoping that it’ll help you out. @Jones-S @curtishenson @michtio @timkelty @darylknight @Maybach91 @wuhhh @jonathanmelville and of course @sebastian-lenz

Also happening to me, I just successfully updated a client site to Craft CMS 4.4.5, and getting this error.

Screenshot 2023-03-24 at 5 03 00 PM

Can’t seem to get it to go away. Anyone find a fix?

Getting deprecation warning on Craft 3.7.30.1, plugin 2.0.0-rc.1

https://verbb.io/craft-plugins/hyper/features

It supports migrations from linkfield

Ran into this today on a site, this time it wouldn’t go away just by rebuilding. Following the thread above, I did indeed find 4 fields that were listed as “Asset” that used to be link fields. They’re all inside a Matrix block, and when I tried to change them back from Assets to Link fields, I got this error:

image

Can’t find a way around it.

I was getting the deprecation warning after upgrading to Craft 4 and nothing helped except performing the upgrade once again. The second time I upgraded from Craft 3 to Craft 4 the depreciation warning was gone.

I also managed to fix this on a site by rebuilding project config after updating to Craft 4.

Subscribing. Seeing this deprecation error in Craft 4 with Link Field 2.1.3-rc

@DynamiteGoesBoom @michtio you can hack around this by sticking this in project somewhere (eg config/app.php):

class_alias(\lenz\linkfield\fields\LinkField::class, '\typedlinkfield\fields\LinkField');

…but this needs to be fixed in Feed Me.

I unfortunately don’t have anything to add about the source of this. But rebuilding the project config locally was a pretty easy fix for me.

For some reason the type key in project config was type: typedlinkfield\fields\LinkField instead of type: lenz\linkfield\fields\LinkField. Seemed like my project-config was for v1, even though in commits I can see it updated. 🤷

I ran into this just now. Editing the migration to double \\, and running ./craft migrate/up --plugin typedlinkfield before all other migrations worked

Sorry, I don’t have a backup of this site from Craft 3. I did try updating the migration and running it again with a backup from last month, which ran all the migrations, but the deprecation warning is still there and won’t go away. This is what I updated those lines to before running it again:

image

+1 to @ctangney-tulip’s solution on the case of the incorrect field types. The craft docs explicitly say they’ll escape the column names but say nothing about column values. The where docs (the function that update calls) also don’t mention anything about value escaping.

Update: I worked around this issue by disabling the exceptions on deprecation warnings. In my case, it was in the config/app.php file - I had a deprecator running that I commented out:

"components" => [
            "deprecator" => [
                //"throwExceptions" => true,
            ],
        ],

@MateuszEckardt you were spot on! I was just able to reproduce your steps. Except in my case, every single link field had changed to Assets. The plugin’s link type field defaults to Assets, so maybe that has something to do with it??

But this really should get fixed, as it has pretty big ramifications and potential for data loss.

Thank you @MateuszEckardt for taking the time 😃

Also getting the deprecation warning on v2.

Any suggestions how to fix the deprecation warning ↑ ? @sebastian-lenz ?

Getting the same error in feedme