public function beforeSave() { if (!$this->id) { $msg = Yii::app()->user->name . ' commented on ' . $this->movie->get('name') . ' "' . $this->comment . '"'; TwitterPost::send($msg); } return parent::beforeSave(); }
private function parsePost($entry) { $post = new TwitterPost(); $post->setID($entry['id_str']); $post->setAuthor($entry['user']['id_str']); $post->setCreated(new DateTime($entry['created_at'])); $post->setBody($entry['text']); $post->setParentID($entry['in_reply_to_status_id']); return $post; }
<?php require_once 'TwitterPost.php'; $tweet = new TwitterPost(); $tweet->send();