/**
  * Query and return a blob column
  * @param ObjectModel\DataObject $do
  * @param Property\AbstractProperty $property
  * @throws Exception
  * @return binary
  */
 public function loadBlob(ObjectModel\DataObject $do, Property\AbstractProperty $property)
 {
     // get table to use
     $table = $this->_getTableFromUri($do->getUri());
     if (!$table) {
         throw new Exception('MISSING_DBTABLE_PARAM');
     }
     $column = $this->_mapper ? $this->_mapper->propertyToDatastoreName($do->getClass(), $property->getId()) : $property->getId();
     // primary key is either part of the mapper configuration or 'id'
     $pkey = $this->_mapper ? $this->_mapper->getPrimaryKey($do->getUri()->getClass()) : Backend::DEFAULT_PKEY;
     $this->_connect();
     // get data from backend
     // @todo Handle complex pkeys (via mapper definition)
     $select = $this->_ressource->select()->from($table, $column)->where("{$pkey} = ?", $do->getUri()->getIdentifier())->limit(1);
     return $this->_ressource->fetchOne($select);
 }
Exemple #2
0
 /**
  * Add a dynamic property to an already declared data object
  * @param AbstractProperty $property
  * @return t41\ObjectModel\DataObject
  */
 public function addProperty(AbstractProperty $property)
 {
     $property->setParent($this);
     $this->_data[$property->getId()] = $property;
     $this->_dna['custom'] = true;
     return $this;
 }