FOSMessageBundle - How to send a message without the field form recipient

Asked
Active3 hr before
Viewed126 times

5 Answers

message
90%

Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers ,Thanks for contributing an answer to Stack Overflow!, Does the stock price drop if one of the largest shareholders of the company sells all their shares? , Stack Overflow Public questions & answers

In your newThreadAction:

$form = $this - > getFormForNewThreadAction($account);
load more v
88%

I currently added my field to the entity with its getter and setter, I created a custom NewThreadMessageFormType which extends Ornicar\MessageBundle\FormType\NewThreadMessageFormType but now I am stuck at this point as I get an error saying:,Same situation here i want to add field to thread entity but am lost with forms please can any one help and describe this step by step.,I am trying to add a new field to the Thread entity and to display it in the newThreadMessage form.,You will probably also want to edit the FormType to add fields, you can use the configuration key new_thread_form.type and extends FormType\NewThreadMessageFormType.

Neither property "foo"
nor method "getFoo()"
nor method "isFoo()"
exists in class "Ornicar\MessageBundle\FormModel\NewThreadMessage"
load more v
72%

I've hide my recipient field form and now I would like to understand where in the controller I can tell the value of the recipient,The form needs his NewThreadMessage as data and you can set your recipients there. That is all folks.,在opencart产品表单中添加一个字段 php 2016-03-08 11:12 回答 1 已采纳 You can define your own custom field in opencart for products. That is the precise and correct way ,In your MessageController:

MessageController :

/**
 * Create a new message thread
 *
 * @return Response
 */
public
function newThreadAction() {
   $form = $this - > container - > get('fos_message.new_thread_form.factory') - > create();
   $formHandler = $this - > container - > get('fos_message.new_thread_form.handler');

   if ($message = $formHandler - > process($form)) {
      return new RedirectResponse($this - > container - > get('router') - > generate('fos_message_thread_view', array(
         'threadId' => $message - > getThread() - > getId()
      )));
   }

   return $this - > container - > get('templating') - > renderResponse('FOSMessageBundle:Message:newThread.html.twig', array(
      'form' => $form - > createView(),
      'data' => $form - > getData()
   ));
}

$form math to :

class NewThreadMessageFormFactory extends AbstractMessageFormFactory {
   /**
    * Creates a new thread message
    *
    * @return Form
    */
   public
   function create() {
      $message = $this - > createModelInstance();

      return $this - > formFactory - > createNamed($this - > formName, $this - > formType, $message);
   }
}

$formHandler match to :

class NewThreadMessageFormHandler extends AbstractMessageFormHandler {
   /**
    * Composes a message from the form data
    *
    * @param AbstractMessage $message
    * @return MessageInterface the composed message ready to be sent
    * @throws InvalidArgumentException if the message is not a NewThreadMessage
    */
   public
   function composeMessage(AbstractMessage $message) {
      if (!$message instanceof NewThreadMessage) {
         throw new\ InvalidArgumentException(sprintf('Message must be a NewThreadMessage instance, "%s" given', get_class($message)));
      }

      return $this - > composer - > newThread() -
         > setSubject($message - > getSubject()) -
         > addRecipient($message - > getRecipient()) -
         > setSender($this - > getAuthenticatedParticipant()) -
         > setBody($message - > getBody()) -
         > getMessage();
   }
}
load more v
65%

in text that is visible.,Each test target either has no form field error indicators, or at least one of the form field error indicators describes:,Note: This rule does not test form field error indicators shown on a different page than that of the test target.,This input element does not have a form field error indicator.

<form>
   <label for="age">Age (years)</label>
   <input type="number" id="age" aria-describedby="error" value="0" />
   <span id="error">Invalid value for age. Age must be at least 1.</span><br />
   <input type="button" value="Submit" />
</form>
load more v
75%

Sending notification message as verb could fail, because verbs are stored as a CharField with a max_length of 255 chars.,Also: Include recipient count in the log.,Recipients of notifications are users with permission to review them, as well as authors of any previous translations or comments of the same string.,Adds a scheduled job that sends notifications about newly created unreviewed suggestions that were submitted, unapproved or unrejected in the last 7 days.

Same here, we should simplify and use imperative form, for example :

        ""
        "
        Calculate and set starts_at and ends_at
        for the WOTs that have no date
        required, but can be prolonged, so they have a value in their
        permit_duration field
           ""
        "
load more v

Other "message-undefined" queries related to "FOSMessageBundle - How to send a message without the field form recipient"