XF 2.2 Getting an error immediately following the Demo to learn how to make an Add-on

philmckrackon

Active member
This is my cli input
Code:
# php cmd.php xf-addon:install-step Demo/Portal 1
PHP Fatal error:  Trait 'Demo\Portal\XF\Db\Schema\Alter' not found in C:\xampp\htdocs\community\src\addons\Demo\Portal\Setup.php on line 10

Fatal error: Trait 'Demo\Portal\XF\Db\Schema\Alter' not found in C:\xampp\htdocs\community\src\addons\Demo\Portal\Setup.php on line 10
And my setup.php file,
Code:
<?php

namespace Demo\Portal;

use XF\AddOn\AbstractSetup;
use XF\AddOn\StepRunnerInstallTrait;
use XF\AddOn\StepRunnerUninstallTrait;
use XF\AddOn\StepRunnerUpgradeTrait;

class Setup extends AbstractSetup
{
    use StepRunnerInstallTrait;
    use StepRunnerUpgradeTrait;
    use StepRunnerUninstallTrait;

    use XF\Db\Schema\Alter;
    use XF\Db\Schema\Create;

    public function installStep1()
    {
        $this->schemaManager()->alterTable('xf_forum', function(Alter $table)
        {
            $table->addColumn('demo_portal_auto_feature', 'tinyint')->setDefault(0);
        });
    }

    public function installStep2()
    {
        $this->schemaManager()->alterTable('xf_thread', function(Alter $table)
        {
            $table->addColumn('demo_portal_featured', 'tinyint')->setDefault(0);
        });
    }
    public function installStep3()
    {
        $this->schemaManager()->createTable('xf_demo_portal_featured_thread', function(Create $table)
        {
            $table->addColumn('thread_id', 'int');
            $table->addColumn('featured_date', 'int');
            $table->addPrimaryKey('thread_id');
        });
    }
}
Any thoughts? Thanks,
 
You've got this far, that's pretty smart. Keep going. There'll be bumps along the way but I'm sure it won't be anything insurmountable.
 
Top Bottom