Still Getting “Use a Class Extension” Warning After Migrating Elgg Plugin

Hi everyone, I need some help because I’m not able to understand where I’m going wrong. I have migrated my plugin to the new format:

1. Created classes/ElggCoaching.php, which extends ElggObject and defines the subtype as coaching using the protected initializeAttributes() method.
2. Created classes/Coaching/Bootstrap.php as the plugin bootstrap, which registers the site menu.
3. Updated elgg-plugin.php with the bootstrap set to Coaching\Bootstrap::class, and added the relevant entities configuration with the correct type, subtype, and class.

However, I am still getting the following warning:

Using an \ElggObject class for subtype coaching has been deprecated. Use a class extension. (Note: This plugin was active but is currently disabled.)

My understanding is that because the plugin is currently disabled, it is not able to create the river item, which is why this warning is being shown. However, I believe I may also need to migrate existing river items, because even though the updated class is ElggCoaching, the entities are still being treated as ElggObject instead of the new class.

Here is the full log:

ELGG.WARNING: Deprecated in 6.3: Using an \ElggObject class for subtype 'coaching' has been deprecated. Use a class extension.  {"backtrace":["[#29] unknown","[#28] /opt/lampp/htdocs/www/elgg6/vendor/elgg/elgg/engine/classes/Elgg/Database.php:379","[#27] /opt/lampp/htdocs/www/elgg6/vendor/elgg/elgg/engine/classes/Elgg/Database.php:206","[#26] /opt/lampp/htdocs/www/elgg6/vendor/elgg/elgg/engine/classes/Elgg/Database/EntityTable.php:310","[#25] /opt/lampp/htdocs/www/elgg6/vendor/elgg/elgg/engine/classes/Elgg/Database/Entities.php:137","[#24] /opt/lampp/htdocs/www/elgg6/vendor/elgg/elgg/engine/classes/Elgg/Database/Entities.php:204","[#23] /opt/lampp/htdocs/www/elgg6/vendor/elgg/elgg/engine/classes/Elgg/Database/Repository.php:108","[#22] /opt/lampp/htdocs/www/elgg6/vendor/elgg/elgg/engine/classes/Elgg/EntityPreloader.php:40","[#21] /opt/lampp/htdocs/www/elgg6/vendor/elgg/elgg/engine/classes/Elgg/Database/River.php:167","[#20] /opt/lampp/htdocs/www/elgg6/vendor/elgg/elgg/engine/classes/Elgg/Database/River.php:198","[#19] /opt/lampp/htdocs/www/elgg6/vendor/elgg/elgg/engine/classes/Elgg/Database/Repository.php:108","[#18] /opt/lampp/htdocs/www/elgg6/vendor/elgg/elgg/engine/classes/Elgg/Database/River.php:69","[#17] /opt/lampp/htdocs/www/elgg6/vendor/elgg/elgg/engine/lib/river.php:102","[#16] /opt/lampp/htdocs/www/elgg6/vendor/elgg/elgg/engine/lib/river.php:215","[#15] /opt/lampp/htdocs/www/elgg6/vendor/elgg/elgg/mod/activity/views/default/river/listing/all.php:55","[#14] /opt/lampp/htdocs/www/elgg6/vendor/elgg/elgg/engine/classes/Elgg/ViewsService.php:416","[#13] /opt/lampp/htdocs/www/elgg6/vendor/elgg/elgg/engine/classes/Elgg/ViewsService.php:351","[#12] /opt/lampp/htdocs/www/elgg6/vendor/elgg/elgg/engine/lib/views.php:157","[#11] /opt/lampp/htdocs/www/elgg6/mod/campus_admin/views/default/resources/index.php:14","[#10] /opt/lampp/htdocs/www/elgg6/vendor/elgg/elgg/engine/classes/Elgg/ViewsService.php:416","[#9] /opt/lampp/htdocs/www/elgg6/vendor/elgg/elgg/engine/classes/Elgg/ViewsService.php:351","[#8] /opt/lampp/htdocs/www/elgg6/vendor/elgg/elgg/engine/lib/views.php:311","[#7] /opt/lampp/htdocs/www/elgg6/vendor/elgg/elgg/engine/classes/Elgg/Router.php:176","[#6] /opt/lampp/htdocs/www/elgg6/vendor/elgg/elgg/engine/classes/Elgg/Router.php:85","[#5] /opt/lampp/htdocs/www/elgg6/vendor/elgg/elgg/engine/classes/Elgg/Router.php:65","[#4] /opt/lampp/htdocs/www/elgg6/vendor/elgg/elgg/engine/classes/Elgg/Application.php:447","[#3] /opt/lampp/htdocs/www/elgg6/vendor/elgg/elgg/engine/classes/Elgg/Application.php:339","[#2] /opt/lampp/htdocs/www/elgg6/vendor/elgg/elgg/engine/classes/Elgg/Application.php:389","[#1] /opt/lampp/htdocs/www/elgg6/index.php:8"],"process_id":6822,"memory_peak_usage":"28 MB","memory_usage":"28 MB","url":"/www/elgg6/","ip":"::1","http_method":"GET","server":"localhost","referrer":null,"unique_id":"aVqCd-I__-gwWZL7YKxxvwAAAAg"}

Any help or guidance would be appreciated. 

  • Usually we use this class constructor:

    class MyObject extends \ElggObject {
    
        const SUBTYPE = 'my_object';
    
        protected function initializeAttributes() {
          parent::initializeAttributes();
          $this->attributes['subtype'] = self::SUBTYPE;
        }
    
    }

     

  • Yes, i have this class constructor. "ElggCoaching" with subtype as "coaching"

  • Rohit,

    It looks like you did everything correct.

    You mentioned that your plugin is still disabled, that is why you get the warning. The system can't find your custom class. Once you plugin is active it should go away.

    However, I believe I may also need to migrate existing river items, because even though the updated class is ElggCoaching, the entities are still being treated as ElggObject instead of the new class.

    No need, once you activate your plugin the system will handle this. (There is no reference in the river table to an Entity class).