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()); }
public function toArray(StoredTag $entity) { return array('tagId' => $entity->getTagId(), 'tagCreated' => $entity->getTagCreated(), 'tagTitle' => $entity->getTitle(), 'tagWeight' => $entity->getWeight(), 'tagUserContext' => $entity->getUserContext()); }
/** * Remove a tag * * @access public * @return boolean the result true if removed * @param QuickTag\Model\StoredTag $tag * @throws QuickTag\QuickTagException if database operation fails */ public function delete(StoredTag $tag) { $result = null; if ($tag->getTagId() === null) { throw new QuickTagException('Given tag does not have a database id assigned can not delete'); } else { $result = $this->gateway->deleteQuery()->start()->filterById($tag->getTagId())->end()->delete(); # reset the tag id if ($result) { $tag->setTagId(0); } } return $result; }