Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
framework
Model
Entity
RepositoryFactory.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Framework\Model\Entity
;
8
9
use
Magento\Framework\ObjectManagerInterface
;
10
use
Magento\Framework\Exception\NotFoundException
;
11
15
class
RepositoryFactory
16
{
22
protected
$entities
;
23
29
protected
$objectManager
;
30
37
public
function
__construct
(
38
ObjectManagerInterface
$objectManager
,
39
array
$entities
= []
40
) {
41
$this->objectManager =
$objectManager
;
42
$this->entities =
$entities
;
43
}
44
50
public
function
create
(
$entityType
)
51
{
52
if
(!isset($this->entities[
$entityType
])) {
53
$message
=
54
sprintf(
'The repository for the "%s" entity type isn\'t declared. Verify and try again.'
,
$entityType
);
55
throw
new
NotFoundException
(
new
\
Magento
\Framework\
Phrase
(
$message
));
56
}
57
return
$this->objectManager->get($this->entities[
$entityType
]);
58
}
59
}
Magento\Framework\Model\Entity\RepositoryFactory\__construct
__construct(ObjectManagerInterface $objectManager, array $entities=[])
Definition:
RepositoryFactory.php:37
Magento\Framework\ObjectManagerInterface
Definition:
ObjectManagerInterface.php:12
Magento\Framework\Model\Entity
Definition:
RepositoryFactory.php:7
$message
$message
Definition:
notifications.php:7
$entityType
$entityType
Definition:
attribute_set_with_image_attribute.php:13
Magento\Framework\Exception\NotFoundException
Definition:
NotFoundException.php:12
Magento\Framework\Model\Entity\RepositoryFactory\create
create($entityType)
Definition:
RepositoryFactory.php:50
Magento
Magento\Framework\Phrase
Definition:
Phrase.php:17
Magento\Framework\Model\Entity\RepositoryFactory\$entities
$entities
Definition:
RepositoryFactory.php:22
Magento\Framework\Model\Entity\RepositoryFactory
Definition:
RepositoryFactory.php:15
Magento\Framework\Model\Entity\RepositoryFactory\$objectManager
$objectManager
Definition:
RepositoryFactory.php:29