Exemplo n.º 1
0
 /**
  * Return an existing or new ViewCount record.
  *
  * @return ViewCount
  */
 public function ViewCount()
 {
     $data = array('RecordID' => $this->owner->ID, 'RecordClass' => ClassInfo::baseDataClass($this->owner->ClassName));
     $count = ViewCount::get()->filter($data)->First();
     if (!$count) {
         $count = new ViewCount();
         $count->update($data);
     }
     return $count;
 }
Exemplo n.º 2
0
 public function doInsertViewCount()
 {
     $viewcount = ViewCount::create();
     $viewcount->ViewCount = 0;
     $viewcount->write();
     return $viewcount->ID;
 }