Code update to 5.7

Permalink
I am trying to migrate this code from 5.6 to 5.7. Any suggestions on how to get the available options for a select page attribute?
Loader::model('attribute/type');
$cak = CollectionAttributeKey::getByHandle($attribute_handle);
$satc = new SelectAttributeTypeController(AttributeType::getByID($attribute_id));
$satc->setAttributeKey($cak);
$values = $satc->getOptions();

SkyBlueSofa
 
exchangecore replied on at Permalink Reply
exchangecore
Are you getting a specefic error when you try that code?

You might try looking at the migration guides that Andrew posted if you haven't already:

Part 1:
http://www.concrete5.org/documentation/how-tos/developers/concrete5...
Part 2:
http://www.concrete5.org/documentation/how-tos/developers/concrete5...
SkyBlueSofa replied on at Permalink Reply
SkyBlueSofa
The error that I get is:
Fatal Error: Class 'SelectAttributeTypeController' not found


I've reviewed both of those posts and while there is a lot of good information, I don't see anything about select attributes either in the code on those pages or in the zip file.
Remo replied on at Permalink Reply
Remo
did you import the required namespaces? "use.."?
exchangecore replied on at Permalink Reply
exchangecore
Give this a shot:

use \Concrete\Attribute\Select\Controller as SelectAttributeTypeController;
SkyBlueSofa replied on at Permalink Best Answer Reply
SkyBlueSofa
I was going through the Concrete/core directory and couldn't find anything. Completely missed the Concrete/attributes directory.

Added this to the top of my file and all works now:
use Concrete\Attribute\Select\Controller as SelectAttributeTypeController;
use Concrete\Core\Attribute\Type as AttributeType;


Thanks for your help.