ethercreative / seo

SEO utilities including a unique field type, sitemap & redirect manager
MIT License
270 stars 96 forks source link

Error migration m201207_124200_add_product_types_to_sitemap::dropCheck() #486

Open gmonseur opened 1 week ago

gmonseur commented 1 week ago

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

timstrawbridge commented 1 week ago

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 commented 1 week ago

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 commented 1 day ago

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