src/Zf2Forum/Service/Discuss.php
public function createMessage(MessageInterface $message)
    {
        // Set post time and persist message.
        $message->setUserId($this->getServiceManager()->get('zfcuser_auth_service')->getIdentity()->getId());
        $message->setTimestampCreated(new \DateTime);

        $this->getEventManager()->trigger(
            __FUNCTION__,
            $message,
            array(
                'message' => $message,
            )
        );

        $message = $this->messageMapper->persist($message);

        $this->getEventManager()->trigger(
            __FUNCTION__ . '.post',
            $message,
            array(
                'message' => $message,
            )
        );
        return $message;
    }
public function createMessage(MessageInterface $message)
    {
        // Set post time and persist message.
        $message->setUserId($this->getServiceManager()->get('zfcuser_auth_service')->getIdentity()->getId());
        $message->setTimestampCreated(new \DateTime);

        $this->getEventManager()->trigger(
            __FUNCTION__,
            $message,
            array(
                'message' => $message,
            )
        );

        $message = $this->messageMapper->persist($message);

        $this->getEventManager()->trigger(
            __FUNCTION__ . '.post',
            $message,
            array(
                'message' => $message,
            )
        );
        return $message;
    }
public function createMessage ( MessageInterface $ message ) { // Set post time and persist message. $ message -> setUserId ( $ this -> getServiceManager ( ) -> get ( 'zfcuser_auth_service' ) -> getIdentity ( ) -> getId ( ) ) ; $ message -> setTimestampCreated ( new \ DateTime ) ; $ this -> getEventManager ( ) -> trigger ( __FUNCTION__ , $ message , array ( 'message' => $ message , ) ) ; $ message = $ this -> messageMapper -> persist ( $ message ) ; $ this -> getEventManager ( ) -> trigger ( __FUNCTION__ . '.post' , $ message , array ( 'message' => $ message , ) ) ; return $ message ; }
createMessage

@param MessageInterface $message
@return MessageInterface
createMessage