/
githubmirror
/
magento2
Обзор
Документация
Войти
/
githubmirror
/
magento2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.4-develop
lib/internal/Magento/Framework/Exception/NoSuchEntityException.php
84 строки
2 KB
Alexandra Zota
ACP2E-4019: CE copyright updates for 2.4.9-beta1
22 окт 2025, 17:47
22 окт 2025, 17:47
1b769b7
Код
Авторство
О чём код?
<?php /** * No such entity service exception * * Copyright 2014 Adobe * All Rights Reserved. */ namespace Magento\Framework\Exception; use Magento\Framework\Phrase; /** * @api * @since 100.0.2 */ class NoSuchEntityException extends LocalizedException { /** * @deprecated */ const MESSAGE_SINGLE_FIELD = 'No such entity with %fieldName = %fieldValue'; /** * @deprecated */ const MESSAGE_DOUBLE_FIELDS = 'No such entity with %fieldName = %fieldValue, %field2Name = %field2Value'; /** * @param \Magento\Framework\Phrase $phrase * @param \Exception $cause * @param int $code */ public function __construct(?Phrase $phrase = null, ?\Exception $cause = null, $code = 0) { if ($phrase === null) { $phrase = new Phrase('No such entity.'); } parent::__construct($phrase, $cause, $code); } /** * Helper function for creating an exception when a single field is responsible for finding an entity. * * @param string $fieldName * @param string|int $fieldValue * @return \Magento\Framework\Exception\NoSuchEntityException */ public static function singleField($fieldName, $fieldValue) { return new self( new Phrase( 'No such entity with %fieldName = %fieldValue', [ 'fieldName' => $fieldName, 'fieldValue' => $fieldValue ] ) ); } /** * Helper function for creating an exception when two fields are responsible for finding an entity. * * @param string $fieldName * @param string|int $fieldValue * @param string $secondFieldName * @param string|int $secondFieldValue * @return \Magento\Framework\Exception\NoSuchEntityException */ public static function doubleField($fieldName, $fieldValue, $secondFieldName, $secondFieldValue) { return new self( new Phrase( 'No such entity with %fieldName = %fieldValue, %field2Name = %field2Value', [ 'fieldName' => $fieldName, 'fieldValue' => $fieldValue, 'field2Name' => $secondFieldName, 'field2Value' => $secondFieldValue, ] ) ); } }