ActivityLog\Model\Event\Model::save PHP Method

save() public method

Save event
public save ( ) : integer | boolean
return integer | boolean
    public function save()
    {
        /**
         * No one can edit an event
         */
        if ($this->getId() !== null) {
            return true;
        }
        $arraySave = array('created_at' => new Expression('NOW()'), 'content' => $this->getContent(), 'template_id' => $this->getTemplateId(), 'user_id' => $this->getUserId());
        try {
            $this->insert($arraySave);
            $this->setId((int) $this->getLastInsertId());
            return $this->getId();
        } catch (\Exception $e) {
            throw new \Gc\Exception($e->getMessage(), $e->getCode(), $e);
        }
    }

Usage Example

Example #1
0
 /**
  * Test
  *
  * @return void
  */
 public function testGetEvents()
 {
     $model = new Model();
     $model->setContent('test');
     $model->setTemplateId(1);
     $model->save();
     $this->assertInternalType('array', $this->object->getEvents());
 }
All Usage Examples Of ActivityLog\Model\Event\Model::save