Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error migration m201207_124200_add_product_types_to_sitemap::dropCheck() #486

Open
gmonseur opened this issue Oct 7, 2024 · 3 comments
Open

Comments

@gmonseur
Copy link

gmonseur commented Oct 7, 2024

Hi everyone,

Description

I get this error when upgrading from craft 3 to 4 with seo 4.0 plugin.
Can you help me please ?

applying m201207_124200_add_product_types_to_sitemap
PHP Compile Error 'yii\base\ErrorException' with message 'Access level to ether\seo\migrations\m201207_124200_add_product_types_to_sitemap::dropCheck() must be public (as in class yii\db\Migration)'

in /media/DATA/www/.../vendor/ether/seo/src/migrations/m201207_124200_add_product_types_to_sitemap.php:39

Steps to reproduce

  1. requires
    craftcms/cms ^4.0 (4.12.5)
    ether/seo 4.0.0 (4.0.0)

  2. composer install (Composer version 2.5.2 2023-02-04 14:33:22)

Additional info

  • Craft version: 4.12.5
  • SEO version: 4.0.0
  • PHP version: 8.2
  • Database driver & version: 10.6.18-MariaDB-0ubuntu0.22.04.1 - Ubuntu 22.04
  • Other Plugins:
    "clubstudioltd/craft-asset-rev": "^7.0",
    "craftcms/cms": "^4.0",
    "craftcms/contact-form": "^3.1.0",
    "craftcms/contact-form-honeypot": "^2.1.0",
    "craftcms/redactor": "^3.0",
    "ether/seo": "4.0.0",
    "la-haute-societe/craft-google-tag-manager": "^2.0",
    "nystudio107/craft-imageoptimize": "^4.0",
    "nystudio107/craft-minify": "^4.0",
    "nystudio107/craft-templatecomments": "^4.0",
    "topshelfcraft/environment-label": "^4.0",
    "verbb/navigation": "^2.0",
    "verbb/super-table": "^3.0",
    "vlucas/phpdotenv": "5.4.0",
    "wbrowar/craft-admin-bar": "^3.0.3",
    "wrav/oembed": "^3.1.1"
@timstrawbridge
Copy link

I wouldn't absolutely rely on this but what if you change the access modifier on the method "dropCheck" to public instead of it being protected?

@gmonseur
Copy link
Author

gmonseur commented Oct 8, 2024

Hi @timstrawbridge

Thanks for your help :)

Yes, if I pass the method in public, I get this error :

*** applying m201207_124200_add_product_types_to_sitemap
PHP Compile Error 'yii\base\ErrorException' with message 'Declaration of ether\seo\migrations\m201207_124200_add_product_types_to_sitemap::dropCheck() must be compatible with yii\db\Migration::dropCheck($name, $table)'

in /media/DATA/www/.../vendor/ether/seo/src/migrations/m201207_124200_add_product_types_to_sitemap.php:39

Stack trace:
#0 [internal function]: yii\base\ErrorHandler->handleFatalError()
#1 {main}
Script @php craft migrate/all handling the post-install-cmd event returned with error code 1

This method exists in the parent class with the required parameters. I don't understand.
vendor/yiisoft/yii2/db/Migration.php (line 544)

    /**
     * Creates a SQL command for dropping a check constraint.
     * @param string $name the name of the check constraint to be dropped.
     * The name will be properly quoted by the method.
     * @param string $table the table whose check constraint is to be dropped.
     * The name will be properly quoted by the method.
     */
    public function dropCheck($name, $table)
    {
        $time = $this->beginCommand("drop check $name in table $table");
        $this->db->createCommand()->dropCheck($name, $table)->execute();
        $this->endCommand($time);
    }

@gmonseur
Copy link
Author

Does anyone have any ideas on how I can continue upgrading? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants