C5-8.4* How to save an attribute programmatically during package install?

Permalink
I'm trying to install a custom attribute during a package install:
$service = $this->app->make('Concrete\Core\Attribute\Category\CategoryService');
$categoryEntity = $service->getByHandle('collection');
$category = $categoryEntity->getController();
$key = new Key();
$category->add('select', $key, $this->selectSettings(['Option 1','Option 2','Option 3']) , $pkg);

but it throws an exception: "Unable to retrieve legacy attribute key for method: setAttributeType"

How can I add a select attribute during install?

 
alboraus replied on at Permalink Reply
Anyone know?