示例#1
0
 /**
  *  Update a tag
  *
  *  @access protected
  *  @return boolean the result true if removed
  *  @param QuickTag\Model\StoredTag $tag
  *  @throws QuickTag\QuickTagException if database operation fails
  */
 protected function updateTag(StoredTag $tag)
 {
     $result = null;
     try {
         $result = $this->gateway->updateQuery()->start()->addColumn('tag_title', $tag->getTitle())->addColumn('tag_weight', $tag->getWeight())->addColumn('tag_user_context', $tag->getUserContext())->where()->filterById($tag->getTagId())->end()->update();
         # normalise the return
         if ($result === null) {
             $result = false;
         }
     } catch (DBALGatewayException $exception) {
         throw new QuickTagException($exception->getMessage(), 0, $exception);
     }
     return $result;
 }
示例#2
0
 public function testEntityProperties()
 {
     $tag_id = 1;
     $tag_user_context = 3;
     $tag_date_created = new DateTime();
     $tag_weight = 3.56;
     $tag_title = 'finance';
     $entity = new StoredTag();
     $entity->setTagId($tag_id);
     $entity->setUserContext($tag_user_context);
     $entity->setTagCreated($tag_date_created);
     $entity->setWeight($tag_weight);
     $entity->setTitle($tag_title);
     $this->assertEquals($tag_id, $entity->getTagId());
     $this->assertEquals($tag_user_context, $entity->getUserContext());
     $this->assertEquals($tag_date_created, $entity->getTagCreated());
     $this->assertEquals($tag_weight, $entity->getWeight());
     $this->assertEquals($tag_title, $entity->getTitle());
 }
示例#3
0
 public function toArray(StoredTag $entity)
 {
     return array('tagId' => $entity->getTagId(), 'tagCreated' => $entity->getTagCreated(), 'tagTitle' => $entity->getTitle(), 'tagWeight' => $entity->getWeight(), 'tagUserContext' => $entity->getUserContext());
 }