31 private $_eventManager;
45 private $_migrationFactory;
62 $connectionName = ModuleDataSetupInterface::DEFAULT_SETUP_CONNECTION
64 parent::__construct($context->getResourceModel(), $connectionName);
65 $this->_eventManager = $context->getEventManager();
66 $this->_logger = $context->getLogger();
67 $this->_migrationFactory = $context->getMigrationFactory();
68 $this->filesystem = $context->getFilesystem();
77 return $this->setupCache;
91 public function getTableRow(
$table, $idField, $rowId, $field =
null, $parentField =
null, $parentId = 0)
94 if (!$this->setupCache->has(
$table, $parentId, $rowId)) {
96 $bind = [
'id_field' => $rowId];
99 ->where(
$connection->quoteIdentifier($idField) .
'= :id_field');
100 if (
null !== $parentField) {
102 $bind[
'parent_id'] = $parentId;
107 return $this->setupCache->get(
$table, $parentId, $rowId, $field);
124 $where = [
$connection->quoteIdentifier($idField) .
'=?' => $rowId];
125 if (
null !== $parentField) {
126 $where[
$connection->quoteIdentifier($parentField) .
'=?'] = $parentId;
131 $this->setupCache->remove(
$table, $parentId, $rowId);
152 if (is_array($field)) {
159 $where = [
$connection->quoteIdentifier($idField) .
'=?' => $rowId];
162 if (is_array($field)) {
163 $oldRow = $this->setupCache->has(
$table, $parentId, $rowId) ?
164 $this->setupCache->get(
$table, $parentId, $rowId) :
166 $newRowData = array_merge($oldRow, $field);
167 $this->setupCache->setRow(
$table, $parentId, $rowId, $newRowData);
169 $this->setupCache->setField(
$table, $parentId, $rowId, $field,
$value);
182 return $this->_eventManager;
192 return $this->filesystem;
203 $data[
'setup'] = $this;
204 return $this->_migrationFactory->create(
$data);
__construct(\Magento\Framework\Module\Setup\Context $context, $connectionName=ModuleDataSetupInterface::DEFAULT_SETUP_CONNECTION)
createMigrationSetup(array $data=[])
getTableRow($table, $idField, $rowId, $field=null, $parentField=null, $parentId=0)
deleteTableRow($table, $idField, $rowId, $parentField=null, $parentId=0)
getTable($tableName, $connectionName=ResourceConnection::DEFAULT_CONNECTION)
updateTableRow($table, $idField, $rowId, $field, $value=null, $parentField=null, $parentId=0)