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
Data
Collection
ModelFactory.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Framework\Data\Collection
;
7
11
class
ModelFactory
12
{
16
protected
$_objectManager
;
17
21
public
function
__construct
(\
Magento
\Framework\
ObjectManagerInterface
$objectManager
)
22
{
23
$this->_objectManager =
$objectManager
;
24
}
25
34
public
function
create
(
$model
, array
$data
= [])
35
{
36
$modelInstance = $this->_objectManager->create(
$model
,
$data
);
37
if
(
false
== $modelInstance instanceof \
Magento
\Framework\Model\AbstractModel) {
38
throw
new \InvalidArgumentException(
$model
.
' is not instance of \Magento\Framework\Model\AbstractModel'
);
39
}
40
return
$modelInstance;
41
}
42
}
Magento\Framework\Data\Collection\ModelFactory\__construct
__construct(\Magento\Framework\ObjectManagerInterface $objectManager)
Definition:
ModelFactory.php:21
Magento\Framework\Data\Collection
Definition:
AbstractDb.php:6
$objectManager
$objectManager
Definition:
bootstrap.php:17
Magento\Framework\ObjectManagerInterface
Definition:
ObjectManagerInterface.php:12
$model
$model
Definition:
enable_catalog_product_reindex_schedule.php:9
Magento\Framework\Data\Collection\ModelFactory\$_objectManager
$_objectManager
Definition:
ModelFactory.php:16
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
Magento\Framework\Data\Collection\ModelFactory\create
create($model, array $data=[])
Definition:
ModelFactory.php:34
Magento
Magento\Framework\Data\Collection\ModelFactory
Definition:
ModelFactory.php:11