Creates a form to delete a message entity.

@param Message $message The message entity

@return \Symfony\Component\Form\Form The form
504957
public function createDeleteForm(Message $message, $access = "ajax")
    {
        $form_name = "message_delete_" . $message->getId();
        return $this->get('form.factory')->createNamedBuilder($form_name,FormType::class)
            ->setAction($this->generateUrl('message_delete', array(
                'id' => $message->getId(),
                'access' => $access)))
            ->setMethod('DELETE')
            ->getForm()
        ;
    }
55259
public function setMessage(\Sopinet\ChatBundle\Entity\Message $message = null)
    {
        $this->message = $message;

        return $this;
    }
60915
public function save(Message $message) : ?Message
    {
        $aggregate = $message->getHeaders()->get(AggregateMessage::AGGREGATE_OBJECT);

        $this->aggregateRepository->save($message->getHeaders()->get(AggregateMessage::CALLING_MESSAGE), $aggregate);

        if ($message->getHeaders()->get(AggregateMessage::IS_FACTORY_METHOD)) {
            $aggregate = $message->getHeaders()->get(AggregateMessage::AGGREGATE_OBJECT);
            $aggregateIds = [];

            foreach ($message->getHeaders()->get(AggregateMessage::AGGREGATE_ID) as $aggregateIdName => $aggregateIdValue) {
                $aggregateIds[$aggregateIdName] = $this->propertyReaderAccessor->getPropertyValue(PropertyPath::createWith($aggregateIdName), $aggregate);
            }

            $payload = count($aggregateIds) === 1 ? array_shift($aggregateIds) : $aggregateIds;

            return
                MessageBuilder::fromMessage($message)
                    ->setPayload($payload)
                    ->build();
        }

        return $message;
    }
1053560
public function addMessage(Message $message): Email
    {
        if (null === $this->message->getBody()) {
            $this->message->setBody($message->getBody(), $message->getContentType());

            return $this;
        }

        $this->message->addPart($message->getBody(), $message->getContentType());

        return $this;
    }
205737
private function createCreateForm(MessageType $entity)
    {
        $form = $this->createForm(MessageTypeType::class, $entity, array(
            'action' => $this->generateUrl('messagetype_create'),
            'method' => 'POST',
        ));
        $this->_addFunctionsToForm($form);

        $form->add('create_group', CheckboxType::class, array('label' => "This is a new group.", 'mapped' => false, 'required' => false));
        $form->add('submit', SubmitType::class, array('label' => 'Create'));

        return $form;
    }
1270621
private function createMessageForm(TicketMessageInterface $message)
    {
        $form = $this->createForm(
            TicketMessageType::class,
            $message,
            ['new_ticket' => false]
        );

        return $form;
    }
510875
private function create($messageClass, $message)
    {
        $interfaces = array_values(class_implements($messageClass, true));
        return new IncomingLogicalMessage($message, $messageClass, $interfaces);
    }
142747
public function deleteMessages($messages)
    {
        $deferred = new Deferred();

        if (! is_array($messages) &&
            ! ($messages instanceof Traversable)
        ) {
            $deferred->reject(new \Exception('$messages must be an array or implement Traversable.'));

            return $deferred->promise();
        }

        $count = count($messages);

        if ($count == 0) {
            $deferred->reject(new \Exception('You cannot delete 0 messages.'));

            return $deferred->promise();
        } elseif ($count == 1) {
            $deferred->reject(new \Exception('You cannot delete 1 message.'));

            return $deferred->promise();
        }

        $messageID = [];

        foreach ($messages as $message) {
            if ($message instanceof Message) {
                $messageID[] = $message->id;
            } else {
                $messageID[] = $message;
            }
        }

        $this->http->post(
            "channels/{$this->id}/messages/bulk_delete",
            [
                'messages' => $messageID,
            ]
        )->then(
            \React\Partial\bind_right($this->resolve, $deferred),
            \React\Partial\bind_right($this->reject, $deferred)
        );

        return $deferred->promise();
    }
1195655
public function delete(QueueMessage $message)
    {
        $queue = $message->getQueueName() ?: $this->queue;

        Resque::dequeue($queue, [static::JOB_CLASS => $message->getId()]);

        return $this;
    }
1360279
public function removeMessage(\Sopinet\ChatBundle\Entity\Message $message)
    {
        $this->messages->removeElement($message);
    }
1110554
public function send(Message $message)
    {
        $mailer = $this->getMailer();
        $mailer->SetFrom($this->getFrom($message));
        $mailer->AddReplyTo($this->getFrom($message));
        $mailer->Subject = $message->getTitle();
        $mailer->AltBody = strip_tags(preg_replace("/<br.*>/i", "\n", $message->getBody()));
        $mailer->MsgHTML($message->getBody());
        $mailer->AddAddress($this->getUserMail($message->getTo()));

        $result = false;
        try {
            if ($mailer->Send()) {
                $message->setStatus(\oat\tao\model\messaging\Message::STATUS_SENT);
                $result = true;
            }
            if ($mailer->IsError()) {
                $message->setStatus(\oat\tao\model\messaging\Message::STATUS_ERROR);
            }
        } catch (phpmailerException $pe) {
            \common_Logger::e($pe->getMessage());
        }
        $mailer->ClearReplyTos();
        $mailer->ClearAllRecipients();
        $mailer->SmtpClose();

        return $result;
    }
306473
public function send(Message $message)
    {
        if ($this->bot === null) {
            throw new NotCreateBotException;
        }
        $arguments = [$message];
        if (in_array(RequestType::class, class_uses($message))) {
            $arguments[] = $message->getCurlType();
        }

        return call_user_func_array([$this->bot, 'send'], $arguments);
    }
1067239
public function transform(Message $message) : Message
    {
        $evaluatedPayload = $this->expressionEvaluationService->evaluate($this->expression,
            [
                "payload" => $message->getPayload(),
                "headers" => $message->getHeaders()->headers()
            ],
            $this->referenceSearchService
        );

        return MessageBuilder::fromMessage($message)
                    ->setPayload($evaluatedPayload)
                    ->build();
    }
397030
public function delete(QueueMessage $message)
    {
        $queue = $message->getQueueName() ?: $this->queue;

        $this->client->useTube($queue)->delete(new Job($message->getId(), ''));

        return $this;
    }
903490
public function form($message = '')
    {
        global $event;

        pagetop(gTxt('rah_terminal'), $message);

        echo
            '<h1 class="txp-heading">'.gTxt('rah_terminal').'</h1>'.n.
            '<form method="post" action="index.php" id="rah_terminal_container" class="txp-container">'.n.
            eInput($event).
            sInput('execute').
            tInput().n.
            '    <p>'.selectInput('type', $this->terminal_labels, get_pref('rah_terminal_last_type')).'</p>'.n.
            '    <p>'.n.
            '        <textarea class="code" name="code" rows="12" cols="20">'.txpspecialchars(ps('code')).'</textarea>'.n.
            '    </p>'.n.
            '    <p>'.n.
            '        <input type="submit" value="'.gTxt('rah_terminal_run').'" class="publish" />'.n.
            '    </p>'.n.
            '</form>' .n;
    }
30072
public function required($message = null)
    {
        $this->setRule(__FUNCTION__, function($val)
                       {
                           if (is_scalar($val)) {
                               $val = trim($val);
                           }
                           return !empty($val);
                       }, $message);
        return $this;
    }
290499
public function deleteAction()
    {
        $server = (new \Cms\Orm\CmsMailServerQuery)->findPk($this->id);
        try {
            if ($server && $server->delete()) {
                $this->getMessenger()->addMessage('messenger.mailServer.deleted');
            }
        } catch (\Mmi\Db\Exception $e) {
            $this->getMessenger()->addMessage('messenger.mailServer.delete.error', false);
        }
        $this->getResponse()->redirect('cmsAdmin', 'mailServer');
    }