Beispiel #1
0
 public function onBeforeWrite()
 {
     //create iLike Counter if it does not yet exist
     if (!$this->ILikeCountID) {
         $ILikeCount = ILikeCount::create();
         $ILikeCount->Count = $this->ILikeCountCount;
         $ILikeCount->write();
         $this->ILikeCountID = $ILikeCount->ID;
     }
     //edit iLine Counter Count directly via TextField
     if ($this->ILikeCountCount) {
         // update existing relation
         $ILikeCount = $this->ILikeCount();
         $ILikeCount->Count = $this->ILikeCountCount;
         $ILikeCount->write();
     }
     parent::onBeforeWrite();
 }