Hi, someone knows this mistake.


(makijero) #1

Hi, someone knows this mistake.

Error
Call to undefined method stdClass::save()

/home/web/public_html/protected/modules/useractivity/controllers/UseractionController.php(951)

939 $criteria = new CDbCriteria;
940 $criteria->condition = “(user1 = ‘$senderId’ AND user2 = ‘$receiverId’) OR (user1 = ‘$receiverId’ AND user2 = ‘$senderId’)”;
941
942 $chatModel = Chats::model()->find($criteria);
943 }
944 $chatModel->lastContacted = $timeUpdate;
945 if ($chatModel->user1 == $senderId){
946 $chatModel->lastToRead = $chatModel->user2;
947 }else{
948 $chatModel->lastToRead = $chatModel->user1;
949 }
950 $chatModel->lastMessage = $encodeMsg;
951 $chatModel->save();
952
953 $messageModel = new Messages();
954 $messageModel->message = $encodeMsg;
955 $messageModel->messageType = $messageType;
956 $messageModel->senderId = $senderId;
957 $messageModel->sourceId = $sourceId;
958 $messageModel->chatId = $chatModel->chatId;
959 $messageModel->createdDate = $timeUpdate;
960 $messageModel->save();
961
962
963 $notifyMessage = ‘contacted you on your product’;
Stack Trace
#0

  • /home/web/public_html/framework/web/actions/CInlineAction.php(49): UseractionController->actionInitiatechat()
    #1
  • /home/s
  • /home/web/public_html/framework/web/CController.php(308): CInlineAction->runWithParams(array())
    #2
  • /home/web/public_html/framework/web/CController.php(286): CController->runAction(CInlineAction)
    #3
  • /home/web/public_html/framework/web/CController.php(265): CController->runActionWithFilters(CInlineAction, array())
    #4
  • /home/web/public_html/framework/web/CWebApplication.php(282): CController->run(“initiatechat”)
    #5
  • /home/web/public_html/framework/web/CWebApplication.php(141): CWebApplication->runController(“useractivity/useraction/initiatechat”)
    #6
  • /home/web/public_html/framework/base/CApplication.php(184): CWebApplication->processRequest()
    #7
    – /home/web/public_html/index.php(13): CApplication->run()
    08 defined(‘YII_DEBUG’) or define(‘YII_DEBUG’,true);
    09 // specify how many levels of call stack should be shown in each log message
    10 defined(‘YII_TRACE_LEVEL’) or define(‘YII_TRACE_LEVEL’,3);
    11
    12 require_once($yii);
    13 Yii::createWebApplication($config)->run();

(tri - Tommy Riboe) #2

How did you declare Messages? Forgot to inherit from a base class containing save()?