OrderNoticesTrait
- Type
- Trait
- Namespace
- craft\commerce\elements\traits
- Implemented by
- craft\commerce\elements\Order
- Since
- 3.3
Adds order notice getters and setters.
View source (opens new window)
# 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
View source (opens new window)
Arguments
$notice
# addNotices()
- Since
- 3.3
Adds a list of notices.
View source (opens new window)
Arguments
$notices
(craft\commerce\models\OrderNotice[]) – An array of notices.
# clearNotices()
- Since
- 3.3
Removes notices for all types or a single type.
View source (opens new window)
Arguments
$type
(string (opens new window), null (opens new window)) – Type name. Use null to remove notices for all types.$attribute
# getFirstNotice()
- Since
- 3.3
Returns the first error of the specified type or attribute
View source (opens new window)
Arguments
$type
(null (opens new window))$attribute
(null (opens new window))
# getNotices()
- Since
- 3.3
Returns the notices for all types/attributes or a single type/attributes.
View source (opens new window)
Arguments
$type
(string (opens new window), null (opens new window)) – Type name. Use null to retrieve notices for all types.$attribute
(string (opens new window), null (opens new window)) – 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.
View source (opens new window)
Arguments
$type
(string (opens new window), null (opens new window)) – Type name. Use null to check all types.$attribute
(string (opens new window), null (opens new window)) – Attribute name. Use null to check all attributes.
Returns
boolean (opens new window) – Whether there is any notices.