public function create($content, $object, array $users, $sender = null, $parent = null)
    {
        $message = new Message();
        $message->setContent($content);
        $message->setParent($parent);
        $message->setObject($object);
        $message->setSender($sender);
        $stringTo = '';

        foreach ($users as $user) {
            $stringTo .= $user->getUsername().';';
        }

        $message->setTo($stringTo);

        return $message;
    }
public function create($content, $object, array $users, $sender = null, $parent = null)
    {
        $message = new Message();
        $message->setContent($content);
        $message->setParent($parent);
        $message->setObject($object);
        $message->setSender($sender);
        $stringTo = '';

        foreach ($users as $user) {
            $stringTo .= $user->getUsername().';';
        }

        $message->setTo($stringTo);

        return $message;
    }
public function create ( $ content , $ object , array $ users , $ sender = null , $ parent = null ) { $ message = new Message ( ) ; $ message -> setContent ( $ content ) ; $ message -> setParent ( $ parent ) ; $ message -> setObject ( $ object ) ; $ message -> setSender ( $ sender ) ; $ stringTo = '' ; foreach ( $ users as $ user ) { $ stringTo .= $ user -> getUsername ( ) . ';' ; } $ message -> setTo ( $ stringTo ) ; return $ message ; }
Create a message.

@param $content      The message content
@param $object       The message object
@param User[] $users  The users receiving the message
@param null   $sender The user sending the message
@param null   $parent The message parent (is it's a discussion)

@return Message
Create a message .