Пример #1
0
 public static function saveMessage(array $message, PropelPDO $con = null)
 {
     $crit = new Criteria();
     $crit->add(self::MESSAGE_ID, $message['id']);
     $rawmessage = self::doSelectOne($crit);
     if (is_null($rawmessage)) {
         $follower = FollowerPeer::createFollower($message['user'], $con);
         $rawmessage = new RawMessage();
         $rawmessage->setMessageId($message['id']);
         $rawmessage->setCreatedAt($message['created_at']);
         $rawmessage->setText($message['text']);
         $rawmessage->setFollower($follower);
         $rawmessage->save();
         return $rawmessage;
     } else {
         return null;
     }
 }