OrderNoticesTrait ​
- Type
- Trait
- Namespace
- craft\commerce\elements\traits
- Implemented by
- craft\commerce\elements\Order
- Since
- 3.3
Adds order notice getters and setters.
Public Methods ​
Method | Description |
---|---|
addNotice() | Adds a new notice |
addNotices() | Adds a list of notices. |
clearNotices() | Removes notices for all types or a single type. |
getFirstNotice() | Returns the first error of the specified type or attribute |
getNotices() | Returns the notices for all types/attributes or a single type/attributes. |
hasNotices() | Returns a value indicating whether there is any notices. |
addNotice()
​
- Since
- 3.3
Adds a new notice
Arguments ​
$notice
addNotices()
​
- Since
- 3.3
Adds a list of notices.
Arguments ​
$notices
(craft\commerce\models\OrderNotice[]) – An array of notices.
clearNotices()
​
- Since
- 3.3
Removes notices for all types or a single type.
Arguments ​
getFirstNotice()
​
- Since
- 3.3
Returns the first error of the specified type or attribute
Arguments ​
getNotices()
​
- Since
- 3.3
Returns the notices for all types/attributes or a single type/attributes.
Arguments ​
$type
(string, null) – Type name. Use null to retrieve notices for all types.$attribute
(string, null) – Attribute name. Use null to retrieve notices for all attributes.
Returns ​
craft\commerce\models\OrderNotice[] – Notices for all types or the specified type / attribute. Empty array is returned if no notice.
hasNotices()
​
- Since
- 3.3
Returns a value indicating whether there is any notices.
Arguments ​
$type
(string, null) – Type name. Use null to check all types.$attribute
(string, null) – Attribute name. Use null to check all attributes.
Returns ​
boolean – Whether there is any notices.