@Route(
"/edit/message/{message}",
name="claro_forum_edit_message"
)

@Template("ClarolineForumBundle:Forum:editMessageForm.html.twig")
@param Message $message
774690
public function editMessageAction(Message $message)
    {
        $subject = $message->getSubject();
        $forum = $subject->getCategory()->getForum();
        $isModerator = $this->authorization->isGranted('moderate', new ResourceCollection(array($forum->getResourceNode())));

        if (!$isModerator && $this->tokenStorage->getToken()->getUser() !== $message->getCreator()) {
            throw new AccessDeniedException();
        }

        $oldContent = $message->getContent();
        $form = $this->container->get('form.factory')->create(new MessageType, new Message());
        $form->handleRequest($this->get('request'));

        if ($form->isValid()) {
            $newContent = $form->get('content')->getData();
            $this->manager->editMessage($message, $oldContent, $newContent);

            return new RedirectResponse(
                $this->generateUrl('claro_forum_messages', array('subject' => $subject->getId()))
            );
        }

        return array(
            'subject' => $subject,
            'form' => $form->createView(),
            'message' => $message,
            '_resource' => $forum,
            'workspace' => $forum->getResourceNode()->getWorkspace()
        );
    }
396671
public function processEmail(Message $message)
    {
        // uncompress the message variables
        $body = json_decode($message->getBody());
        $message = $this->uncompressMessage($body->m);
        $variables = $message;
        if (property_exists($body, 'v')) {
            $variables = $this->uncompressMessage($body->v);
        }

        $this->send($message, $body->t, $variables);
    }
1069376
public function logMessage(Message $message) {
        foreach($this->logger as $logger) {
            $logger->logMessage($message);
        }
    }
1099229
public function editAction()
    {
        if (\App\Registry::$config->ldap) {
            $this->view->ldap = \App\Registry::$config->ldap->active;
        }

        $form = new \CmsAdmin\Form\Auth(new \Cms\Orm\CmsAuthRecord($this->id));
        if ($form->isSaved()) {
            $this->getMessenger()->addMessage('messenger.auth.saved', true);
            $this->getResponse()->redirect('cmsAdmin', 'auth');
        }
        $this->view->authForm = $form;
    }
974604
public function logMessage(Message $message): void
    {
        if (in_array($message->getLevel(), $this->config['log'])) {
            // If script is running for very long time (e.g. CRON), then date might change if time passes midnight.
            // In that case, log will continue to write messages to new file.

            $fpFile = $this->getFileName();
            if ($fpFile !== $this->fpFile) {
                //date has changed? or we need to init?
                if ($this->fp) {
                    // close pointer to old file
                    @fclose($this->fp);
                }

                if ($this->config['path'] === null) {
                    $path = Application::getStoragePath('log' . DS . $fpFile);
                } else {
                    $path = str_replace(DS . DS, DS, $this->config['path'] . DS . $fpFile);
                }

                $this->fpFile = $fpFile;

                if (!($this->fp = @fopen($path, 'a'))) {
                    // file failed to open, maybe directory doesn't exists?
                    $dir = dirname($path);
                    if (!is_dir($dir)) {
                        Directory::mkdir($dir, $this->mode);
                    }

                    if (!($this->fp = @fopen($path, 'a'))) {
                        // now the directory should exists, so try to open file again
                        throw new Exception('Can not write to log file on path=' . $path);
                    }
                }
            }

            if (!$this->fp || $this->fp === null) {
                if ($this->config['path'] === null) {
                    $path = Application::getStoragePath('log' . DS . $fpFile);
                } else {
                    $path = str_replace(DS . DS, DS, $this->config['path'] . DS . $fpFile);
                }

                throw new Exception("Can not write to log file path={$path}");
            }

            if ($this->getMessageFunction !== null) {
                $line = call_user_func($this->getMessageFunction, $message);
            } else {
                $time = $message->getTime()->format('y-m-d H:i:s.v');
                $level = strtoupper($message->getLevel());
                $space = str_repeat(' ', 10 - strlen($level));
                $who = $message->getWho() ?? Log::getWho();
                $line = "{$time} {$level}{$space}{$who}\t{$message->getMessage()}\n";
            }

            if (!@fwrite($this->fp, $line)) { // actually write it in file
                throw new Exception('Unable to write to log file');
            }
        }
    }
838509
public static function message(Message $message): void
    {
        static::init();

        foreach (static::$adapters as $adapter) {
            /* @var $adapter \Koldy\Log\Adapter\AbstractLogAdapter */
            if ($adapter->isLevelEnabled($message->getLevel())) {
                $adapter->logMessage($message);
            }
        }
    }
615066
protected function SendMessage($message)
    {
        $this->signal_data->message = $message;
        
        $this->Send(
            \Peg\Lib\Signals\Type\Lexers::LEXER_MESSAGE,
            $this->signal_data
        );
    }
588570
public static function t($message, array $params = [], $language = null)
    {
        return parent::baseT('admin', $message, $params, $language);
    }
271424
public function load(Message $message) : Message
    {
        $commandReflection = new \ReflectionClass($message->getPayload());
        $aggregateIdentifiers = [];
        $expectedVersion   = null;
        foreach ($commandReflection->getProperties() as $property) {
            if (preg_match("*AggregateIdAnnotation*", $property->getDocComment())) {
                $property->setAccessible(true);
                $value = (string)$property->getValue($message->getPayload());
                if ($value) {
                    $aggregateIdentifiers[$property->getName()] = $value;
                }
            }
            if (preg_match("*AggregateExpectedVersionAnnotation*", $property->getDocComment())) {
                $property->setAccessible(true);
                $expectedVersion = $property->getValue($message->getPayload());
            }
        }

        $aggregate = null;
        if (!$this->isFactoryMethod) {
            if (!$aggregateIdentifiers) {
                throw AggregateNotFoundException::create("There is no aggregate id to search for found. Are you sure you defined AggregateId Annotation or are not aggregateIdentifiers null?");
            }

            $aggregate = is_null($expectedVersion)
                ? $this->aggregateRepository->findBy($aggregateIdentifiers)
                : $this->aggregateRepository->findWithLockingBy($aggregateIdentifiers, $expectedVersion);
        }

        $messageBuilder = MessageBuilder::fromMessage($message);
        if ($aggregate) {
            $messageBuilder = $messageBuilder->setHeader(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_HEADER, $aggregate);
        }
        if ($expectedVersion) {
            $messageBuilder = $messageBuilder->setHeader(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_EXPECTED_VERSION_HEADER, $expectedVersion);
        }

        return $messageBuilder
            ->setHeader(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_CLASS_NAME_HEADER, $this->aggregateClassName)
            ->setHeader(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_METHOD_HEADER, $this->aggregateMethod)
            ->setHeader(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_REPOSITORY_HEADER, $this->aggregateRepository)
            ->setHeader(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_ID_HEADER, $aggregateIdentifiers)
            ->setHeader(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_IS_FACTORY_METHOD_HEADER, $this->isFactoryMethod)
            ->setHeader(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_MESSAGE_HEADER, $message->getPayload())
            ->build();
    }
761400
public function addMessage($message) {
        $migrationName = get_class($this);
        $this->messages[] = sprintf("%s:  %s\n", $migrationName, $message);
    }
484057
protected function note(...$message): void
    {
        if ($this->notice instanceof Notice) {
            $this->notice->add($message);
        }
    }
1283242
public function message($message)
    {
        if(trim($message))
        {
            $msg = new stdClass();
            $msg->type = 'text';
            $msg->message = $message;
            $this->messages[] = $msg;
        }        
    }
481697
public static function addEditLog($message, Tree $tree): void
    {
        self::addLog($message, self::TYPE_EDIT, $tree);
    }
541450
public function removeMessage(\BisonLab\SakonninBundle\Entity\Message $messages)
    {
        $this->messages->removeElement($messages);
    }
747683
protected function applyMessageOptions(Message $message)
    {
        if (empty($this->config['message']['options']) || !is_array($this->config['message']['options'])) {
            return $message;
        }

        foreach ($this->config['message']['options'] as $key => $value) {
            $method = 'set'.ucfirst($key);

            if (is_callable(array($message, $method))) {
                if (!is_array($value)) {
                    $value = array($value);
                }
                call_user_func_array(array($message, $method), $value);
            }
        }

        return $message;
    }
1015239
public function setMessage($message)
    {
        $messageVariables = null;

        if (is_array($message)) {
            if (array_key_exists('messageVariables', $message)) {
                $messageVariables = $message['messageVariables'];
            }

            if (array_key_exists('message', $message)) {
                $message = $message['message'];
            } else {
                $messageVariables = $message;
                $message          = $this->messageTemplate;
            }
        }

        if (!is_string($message)) {
            throw new InvalidArgumentException(
                sprintf(
                    'Wrong parameters for %s([array|string $message]); %s given.',
                    __METHOD__,
                    is_object($message) ? get_class($message) : gettype($message)
                ),
                E_ERROR
            );
        }

        $this->message = $this->createMessage($message, $messageVariables);

        return $this;
    }
148061
public function send(Message $message) : void
    {
        $destination = $this->getRedirectURL($message);
        Utils::getContainer()->getLogger()->debug('Redirect to '.strlen($destination).' byte URL: '.$destination);
        Utils::getContainer()->redirect($destination);
    }