Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
NoSuchEntityException.php
Go to the documentation of this file.
1 <?php
9 
11 
17 {
21  const MESSAGE_SINGLE_FIELD = 'No such entity with %fieldName = %fieldValue';
22 
26  const MESSAGE_DOUBLE_FIELDS = 'No such entity with %fieldName = %fieldValue, %field2Name = %field2Value';
27 
33  public function __construct(Phrase $phrase = null, \Exception $cause = null, $code = 0)
34  {
35  if ($phrase === null) {
36  $phrase = new Phrase('No such entity.');
37  }
38  parent::__construct($phrase, $cause, $code);
39  }
40 
48  public static function singleField($fieldName, $fieldValue)
49  {
50  return new self(
51  new Phrase(
52  'No such entity with %fieldName = %fieldValue',
53  [
54  'fieldName' => $fieldName,
55  'fieldValue' => $fieldValue
56  ]
57  )
58  );
59  }
60 
70  public static function doubleField($fieldName, $fieldValue, $secondFieldName, $secondFieldValue)
71  {
72  return new self(
73  new Phrase(
74  'No such entity with %fieldName = %fieldValue, %field2Name = %field2Value',
75  [
76  'fieldName' => $fieldName,
77  'fieldValue' => $fieldValue,
78  'field2Name' => $secondFieldName,
79  'field2Value' => $secondFieldValue,
80  ]
81  )
82  );
83  }
84 }
static doubleField($fieldName, $fieldValue, $secondFieldName, $secondFieldValue)
__construct(Phrase $phrase=null, \Exception $cause=null, $code=0)
$code
Definition: info.phtml:12