MessagePickerTrait
Discussion message picker: self-reference (the parent message in the tree).
The trait carries the manager itself (#[Inject]), so the presenter must not take it in its
constructor; otherwise the property collides with a private readonly constructor parameter.
The grid data source and the form read $this->messageManager from this trait.
Table of Contents
Properties
Methods
- messagePicker() : PickerConfig
- messageLabel() : string
- resolveMessageLabel() : string|null
- Returns the label for prefilling the edit form (from the hidden value).
- suggestMessages() : array<int, array{id: int, label: string}>
- Suggests messages by a `LIKE` match on the subject, optionally without the excluded node and its whole subtree (a message must not become the parent of itself or its descendant).
Properties
$messageManager
public
MessageManager
$messageManager
Attributes
- #[Inject]
Methods
messagePicker()
protected
messagePicker(string $formName, string $targetField[, int|null $excludeId = null ][, int|null $excludeSubtreeLft = null ][, int|null $excludeSubtreeRgt = null ]) : PickerConfig
Parameters
- $formName : string
-
name of the form with the hidden field (
editForm) - $targetField : string
-
name of the hidden control (
parentId) - $excludeId : int|null = null
-
id that must not be selected (self-reference)
- $excludeSubtreeLft : int|null = null
-
lftof the edited node (excludes the whole subtree) - $excludeSubtreeRgt : int|null = null
-
rgtof the edited node (excludes the whole subtree)
Return values
PickerConfigmessageLabel()
private
messageLabel(Message $message) : string
Parameters
- $message : Message
Return values
stringresolveMessageLabel()
Returns the label for prefilling the edit form (from the hidden value).
private
resolveMessageLabel(int $id) : string|null
Parameters
- $id : int
Return values
string|nullsuggestMessages()
Suggests messages by a `LIKE` match on the subject, optionally without the excluded node and its whole subtree (a message must not become the parent of itself or its descendant).
private
suggestMessages(string $query[, int|null $excludeId = null ][, int|null $excludeSubtreeLft = null ][, int|null $excludeSubtreeRgt = null ]) : array<int, array{id: int, label: string}>
Parameters
- $query : string
- $excludeId : int|null = null
- $excludeSubtreeLft : int|null = null
- $excludeSubtreeRgt : int|null = null