Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
StatementFactory.php
Go to the documentation of this file.
1 <?php
8 
11 
17 {
21  private $objectManager;
22 
26  private $className;
27 
31  private $referenceClassName;
32 
40  public function __construct(
41  ObjectManagerInterface $objectManager,
42  $className = Statement::class,
43  $referenceClassName = ReferenceStatement::class
44  ) {
45  $this->objectManager = $objectManager;
46  $this->className = $className;
47  $this->referenceClassName = $referenceClassName;
48  }
49 
61  public function create(
62  string $name,
63  string $tableName,
64  string $type,
65  string $statement,
66  string $resource,
67  string $elementType = null
68  ) {
69  $className = $elementType === Reference::TYPE ? $this->referenceClassName : $this->className;
70  return $this->objectManager->create($className, [
71  'name' => $name,
72  'tableName' => $tableName,
73  'resource' => $resource,
74  'type' => $type,
75  'statement' => $statement
76  ]);
77  }
78 }
$tableName
Definition: trigger.php:13
$objectManager
Definition: bootstrap.php:17
create(string $name, string $tableName, string $type, string $statement, string $resource, string $elementType=null)
$resource
Definition: bulk.php:12
$type
Definition: item.phtml:13
__construct(ObjectManagerInterface $objectManager, $className=Statement::class, $referenceClassName=ReferenceStatement::class)
if(!isset($_GET['name'])) $name
Definition: log.php:14