Adding attributes in pkg?

Permalink
Hi I'm trying to get my pkg to add some file attributes, to populate later, however i'm getting the error:

Object of class Concrete\Core\Entity\Attribute\Type could not be converted to string

Any ideas what i'm doing wrong, kinda shooting in the dark as everything I find related to adding page attributes not file attributes.

Thanks in advance

public static function createFileAttributes($pkg)
    {
      $fileAttributes = array('Drive ID','Drive Parent ID','Drivecast Series');
      foreach ($fileAttributes as $attrName) {
        $keyHandle = strtolower(str_replace(' ', '_', $fileAttribute));
      $attrSet = AttributeSet::getByHandle('drivecast');
      $attrType = AttributeType::getByHandle('textarea');
      $attrKey = AttributeKeyCategory::getByHandle($keyHandle);
        if (!is_object($attrKey)) {
            $attrKey = AttributeKeyCategory::add(
                $attrType,
                array(
                    'akHandle' => $keyHandle,
                    'akName' => t($attrName),
                    'akIsSearchable' => 1,

BHWW
 
mnakalay replied on at Permalink Reply
mnakalay
you have an error in your code
foreach ($fileAttributes as $attrName) {

should be
foreach ($fileAttributes as $fileAttribute) {

since later you are using $fileAttribute and not $attrNameto get the attribute handle