Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Member Functions
Inbox Class Reference
Inheritance diagram for Inbox:
AbstractModel NotifierInterface InboxInterface DataObject

Public Member Functions

 getSeverities ($severity=null)
 
 loadLatestNotice ()
 
 getNoticeStatus ()
 
 parse (array $data)
 
 add ($severity, $title, $description, $url='', $isInternal=true)
 
 addCritical ($title, $description, $url='', $isInternal=true)
 
 addMajor ($title, $description, $url='', $isInternal=true)
 
 addMinor ($title, $description, $url='', $isInternal=true)
 
 addNotice ($title, $description, $url='', $isInternal=true)
 
- Public Member Functions inherited from AbstractModel
 __construct (\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
 
 __sleep ()
 
 __wakeup ()
 
 setIdFieldName ($name)
 
 getIdFieldName ()
 
 getId ()
 
 setId ($value)
 
 isDeleted ($isDeleted=null)
 
 hasDataChanges ()
 
 setData ($key, $value=null)
 
 unsetData ($key=null)
 
 setDataChanges ($value)
 
 getOrigData ($key=null)
 
 setOrigData ($key=null, $data=null)
 
 dataHasChangedFor ($field)
 
 getResourceName ()
 
 getResourceCollection ()
 
 getCollection ()
 
 load ($modelId, $field=null)
 
 beforeLoad ($identifier, $field=null)
 
 afterLoad ()
 
 isSaveAllowed ()
 
 setHasDataChanges ($flag)
 
 save ()
 
 afterCommitCallback ()
 
 isObjectNew ($flag=null)
 
 beforeSave ()
 
 validateBeforeSave ()
 
 getCacheTags ()
 
 cleanModelCache ()
 
 afterSave ()
 
 delete ()
 
 beforeDelete ()
 
 afterDelete ()
 
 afterDeleteCommit ()
 
 getResource ()
 
 getEntityId ()
 
 setEntityId ($entityId)
 
 clearInstance ()
 
 getStoredData ()
 
 getEventPrefix ()
 
- Public Member Functions inherited from DataObject
 __construct (array $data=[])
 
 addData (array $arr)
 
 setData ($key, $value=null)
 
 unsetData ($key=null)
 
 getData ($key='', $index=null)
 
 getDataByPath ($path)
 
 getDataByKey ($key)
 
 setDataUsingMethod ($key, $args=[])
 
 getDataUsingMethod ($key, $args=null)
 
 hasData ($key='')
 
 toArray (array $keys=[])
 
 convertToArray (array $keys=[])
 
 toXml (array $keys=[], $rootName='item', $addOpenTag=false, $addCdata=true)
 
 convertToXml (array $arrAttributes=[], $rootName='item', $addOpenTag=false, $addCdata=true)
 
 toJson (array $keys=[])
 
 convertToJson (array $keys=[])
 
 toString ($format='')
 
 __call ($method, $args)
 
 isEmpty ()
 
 serialize ($keys=[], $valueSeparator='=', $fieldSeparator=' ', $quote='"')
 
 debug ($data=null, &$objects=[])
 
 offsetSet ($offset, $value)
 
 offsetExists ($offset)
 
 offsetUnset ($offset)
 
 offsetGet ($offset)
 

Protected Member Functions

 _construct ()
 
- Protected Member Functions inherited from AbstractModel
 _construct ()
 
 _init ($resourceModel)
 
 _setResourceModel ($resourceName, $collectionName=null)
 
 _getResource ()
 
 _getEventData ()
 
 _beforeLoad ($modelId, $field=null)
 
 _afterLoad ()
 
 _hasModelChanged ()
 
 _getValidatorBeforeSave ()
 
 _createValidatorBeforeSave ()
 
 _getValidationRulesBeforeSave ()
 
 _clearReferences ()
 
 _clearData ()
 
- Protected Member Functions inherited from DataObject
 _getData ($key)
 
 _underscore ($name)
 

Additional Inherited Members

- Protected Attributes inherited from AbstractModel
 $_eventPrefix = 'core_abstract'
 
 $_eventObject = 'object'
 
 $_idFieldName = 'id'
 
 $_hasDataChanges = false
 
 $_origData
 
 $_isDeleted = false
 
 $_resource
 
 $_resourceCollection
 
 $_resourceName
 
 $_collectionName
 
 $_cacheTag = false
 
 $_dataSaveAllowed = true
 
 $_isObjectNew = null
 
 $_validatorBeforeSave = null
 
 $_eventManager
 
 $_cacheManager
 
 $_registry
 
 $_logger
 
 $_appState
 
 $_actionValidator
 
 $storedData = []
 
- Protected Attributes inherited from DataObject
 $_data = []
 
- Static Protected Attributes inherited from DataObject
static $_underscoreCache = []
 

Detailed Description

AdminNotification Inbox model

@method int getSeverity() @method \Magento\AdminNotification\Model\Inbox setSeverity(int $value) @method string getDateAdded() @method \Magento\AdminNotification\Model\Inbox setDateAdded(string $value) @method string getTitle() @method \Magento\AdminNotification\Model\Inbox setTitle(string $value) @method string getDescription() @method \Magento\AdminNotification\Model\Inbox setDescription(string $value) @method string getUrl() @method \Magento\AdminNotification\Model\Inbox setUrl(string $value) @method int getIsRead() @method \Magento\AdminNotification\Model\Inbox setIsRead(int $value) @method int getIsRemove() @method \Magento\AdminNotification\Model\Inbox setIsRemove(int $value)

@api

Since
100.0.2

Definition at line 33 of file Inbox.php.

Member Function Documentation

◆ _construct()

_construct ( )
protected
Returns
void

Definition at line 38 of file Inbox.php.

39  {
40  $this->_init(\Magento\AdminNotification\Model\ResourceModel\Inbox::class);
41  }

◆ add()

add (   $severity,
  $title,
  $description,
  $url = '',
  $isInternal = true 
)

Add new message

Parameters
int$severity
string$title
string|string[]$description
string$url
bool$isInternal
Exceptions

Implements NotifierInterface.

Definition at line 106 of file Inbox.php.

107  {
108  if (!$this->getSeverities($severity)) {
109  throw new \Magento\Framework\Exception\LocalizedException(__('Wrong message type'));
110  }
111  if (is_array($description)) {
112  $description = '<ul><li>' . implode('</li><li>', $description) . '</li></ul>';
113  }
114  $date = date('Y-m-d H:i:s');
115  $this->parse(
116  [
117  [
118  'severity' => $severity,
119  'date_added' => $date,
120  'title' => $title,
121  'description' => $description,
122  'url' => $url,
123  'internal' => $isInternal,
124  ],
125  ]
126  );
127  return $this;
128  }
$title
Definition: default.phtml:14
__()
Definition: __.php:13

◆ addCritical()

addCritical (   $title,
  $description,
  $url = '',
  $isInternal = true 
)

Add critical severity message

Parameters
string$title
string|string[]$description
string$url
bool$isInternal
Returns
$this

Implements NotifierInterface.

Definition at line 139 of file Inbox.php.

140  {
142  return $this;
143  }
$title
Definition: default.phtml:14
add($severity, $title, $description, $url='', $isInternal=true)
Definition: Inbox.php:106

◆ addMajor()

addMajor (   $title,
  $description,
  $url = '',
  $isInternal = true 
)

Add major severity message

Parameters
string$title
string|string[]$description
string$url
bool$isInternal
Returns
$this

Implements NotifierInterface.

Definition at line 154 of file Inbox.php.

155  {
157  return $this;
158  }
$title
Definition: default.phtml:14
add($severity, $title, $description, $url='', $isInternal=true)
Definition: Inbox.php:106

◆ addMinor()

addMinor (   $title,
  $description,
  $url = '',
  $isInternal = true 
)

Add minor severity message

Parameters
string$title
string|string[]$description
string$url
bool$isInternal
Returns
$this

Implements NotifierInterface.

Definition at line 169 of file Inbox.php.

170  {
172  return $this;
173  }
$title
Definition: default.phtml:14
add($severity, $title, $description, $url='', $isInternal=true)
Definition: Inbox.php:106

◆ addNotice()

addNotice (   $title,
  $description,
  $url = '',
  $isInternal = true 
)

Add notice

Parameters
string$title
string|string[]$description
string$url
bool$isInternal
Returns
$this

Implements NotifierInterface.

Definition at line 184 of file Inbox.php.

185  {
187  return $this;
188  }
$title
Definition: default.phtml:14
add($severity, $title, $description, $url='', $isInternal=true)
Definition: Inbox.php:106

◆ getNoticeStatus()

getNoticeStatus ( )

{Retrieve notice statuses

Returns
array @api
}

Implements InboxInterface.

Definition at line 78 of file Inbox.php.

79  {
80  return $this->getResource()->getNoticeStatus($this);
81  }

◆ getSeverities()

getSeverities (   $severity = null)

{Retrieve Severity collection array

Parameters
int | null$severity
Returns
array|string|null @api
}

Implements InboxInterface.

Definition at line 46 of file Inbox.php.

47  {
48  $severities = [
53  ];
54 
55  if ($severity !== null) {
56  if (isset($severities[$severity])) {
57  return $severities[$severity];
58  }
59  return null;
60  }
61 
62  return $severities;
63  }
__()
Definition: __.php:13

◆ loadLatestNotice()

loadLatestNotice ( )

{Retrieve Latest Notice

Returns
$this @api
}

Implements InboxInterface.

Definition at line 68 of file Inbox.php.

69  {
70  $this->setData([]);
71  $this->getResource()->loadLatestNotice($this);
72  return $this;
73  }

◆ parse()

parse ( array  $data)

Parse and save new data

Parameters
array$data
Returns
$this

Definition at line 89 of file Inbox.php.

90  {
91  $this->getResource()->parse($this, $data);
92  return $this;
93  }

The documentation for this class was generated from the following file: