Using traits outside the file

Hi I want to create a trait outside of the file where I am using it.

this is my trait in /application/Controllers/infoOne.php

<?php
namespace Application\Controller;

use Page;
use User;
use UserInfo;

defined('C5_EXECUTE') or die(_("Access Denied."));


trait InfoOne  {

    public function sdk () {
        return 'foobar';
    }

}

and this is my class where i want to use the trait
\Application\Controllers\SinglePage\manager.php

<?php

namespace Application\Controller\SinglePage;

use Concrete\Core\Page\Controller\PageController;
use Page;
use User;
use UserInfo;
use Application\Controller\InfoOne;


defined('C5_EXECUTE') or die(_("Access Denied."));


class Manager extends PageController  {

    use InfoOne;

}

but if I execute it, I get an error-message:

-Trait ‘Application\Controller\InfoOne’ not found

it seems like it has something to do with the autoloader but I cant figure out the problem.

Thanks for your help :slight_smile:

Okay it seems like the autoloader is only collecting classes but no traits.
So the solutions in my case is to include it manually :

<?php

namespace Application\Controller\SinglePage;

use Concrete\Core\Page\Controller\PageController;
use Page;
use User;
use UserInfo;
use Application\Controller\InfoOne;


defined('C5_EXECUTE') or die(_("Access Denied."));

if(!@include_once(DIR_BASE.'/application/controllers/traits/infoone.php')) {
        echo 'no include io';die();
}


class Manager extends PageController  {

    use Infoone;

}

I don’t know about traits in /application.

Traits and interfaces definitely autoload correctly from packages.