private function addFileAttributeKeys($pkg)
 {
     $att = FileAttributeKey::getByHandle("db_table_demo");
     if (!$att) {
         FileAttributeKey::add('db_table_demo', array('akHandle' => 'db_table_demo', 'akName' => t('Database Table Tutorial Demo'), 'akIsSearchable' => true), $pkg);
     }
 }
 public function skipItem()
 {
     $key = false;
     switch ($this->object->getCategory()) {
         case 'collection':
             $key = CollectionKey::getByHandle($this->object->getHandle());
             break;
         case 'file':
             $key = FileKey::getByHandle($this->object->getHandle());
             break;
         case 'user':
             $key = UserKey::getByHandle($this->object->getHandle());
             break;
     }
     return is_object($key);
 }
Пример #3
0
 /**
  * Necessary because getAttribute() returns the Value Value object, and this returns the
  * File Attribute Value object.
  *
  * @param $ak
  * @param $createIfNotExists bool
  *
  * @return mixed
  */
 public function getAttributeValueObject($ak, $createIfNotExists = false)
 {
     if (!is_object($ak)) {
         $ak = FileKey::getByHandle($ak);
     }
     $value = false;
     if (is_object($ak)) {
         $value = $this->getObjectAttributeCategory()->getAttributeValue($ak, $this);
     }
     if ($value) {
         return $value;
     } elseif ($createIfNotExists) {
         if (!is_object($ak)) {
             $ak = FileKey::getByHandle($ak);
         }
         $attributeValue = new FileValue();
         $attributeValue->setVersion($this);
         $attributeValue->setAttributeKey($ak);
         return $attributeValue;
     }
 }