diff --git a/src/Jeeves/Generators/Crud/Controllers/Edit.php b/src/Jeeves/Generators/Crud/Controllers/Edit.php index b02797c..c91f89f 100644 --- a/src/Jeeves/Generators/Crud/Controllers/Edit.php +++ b/src/Jeeves/Generators/Crud/Controllers/Edit.php @@ -121,7 +121,7 @@ public function genAdminEditController( . ');' . PHP_EOL . '$resultPage->getConfig()->getTitle()->prepend(__(\'' . $entityName . '\')->render());' . PHP_EOL . '$resultPage->getConfig()->getTitle()->prepend(' . PHP_EOL - . self::TAB . '$entity->getId() ? $entity->getTitle() : __(\'New ' . $entityName . '\')->render()' . PHP_EOL + . self::TAB . '$entityId ? $entity->getTitle() : __(\'New ' . $entityName . '\')->render()' . PHP_EOL . ');' . PHP_EOL . PHP_EOL . 'return $resultPage;'); $namespace->addUse('\Magento\Framework\Exception\NoSuchEntityException'); diff --git a/src/Jeeves/Generators/Crud/Interfaces/Model.php b/src/Jeeves/Generators/Crud/Interfaces/Model.php index b21ce51..a9d52b5 100644 --- a/src/Jeeves/Generators/Crud/Interfaces/Model.php +++ b/src/Jeeves/Generators/Crud/Interfaces/Model.php @@ -45,6 +45,10 @@ public function genModelInterface( $pk[$name] = $value; $pk[$name]['nullable'] = !$notNullable; } + $generated = false; + if (isset($value['identity']) && $value['identity'] === true) { + $generated = true; + } $interface->addConstant(strtoupper($name), strtolower($name))->setPublic(); $method = $this->snakeCaseToUpperCamelCase($name); $get = $interface->addMethod('get' . $method) @@ -58,7 +62,7 @@ public function genModelInterface( if ($typehint) { $get->setReturnType($this->convertType($value['type'])); - $get->setReturnNullable(!$notNullable); + $get->setReturnNullable($generated ? true : !$notNullable); $param->setNullable(!$notNullable); $param->setType($this->convertType($value['type'])); $set->setReturnType('self'); @@ -84,6 +88,11 @@ public function genModelInterface( if ($primary !== self::DEFAULT_KEY && count($pk) === 1) { $item = current($pk); + $generated = false; + if (isset($item['identity']) && $item['identity'] === true) { + $generated = true; + } + $getId = $interface ->addMethod('getId') ->addComment('Get ID') @@ -95,7 +104,7 @@ public function genModelInterface( if ($typehint) { $getId->setReturnType($this->convertType($item['type'])); - $getId->setReturnNullable($item['nullable']); + $getId->setReturnNullable($generated ? true : $item['nullable']); } $setId = $interface @@ -103,7 +112,7 @@ public function genModelInterface( ->addComment('Set ID') ->setVisibility('public'); - $setIdParam = $setId->addParameter(self::DEFAULT_KEY); + $setId->addParameter(self::DEFAULT_KEY); $setId->addComment('@param ' . $this->convertType($item['type']) . ' $id'); if ($hasApi || !$typehint) { diff --git a/src/Jeeves/Generators/Crud/Models/Model.php b/src/Jeeves/Generators/Crud/Models/Model.php index f4f1990..b99e435 100644 --- a/src/Jeeves/Generators/Crud/Models/Model.php +++ b/src/Jeeves/Generators/Crud/Models/Model.php @@ -62,6 +62,10 @@ public function genModel( $pk[$name] = $value; $pk[$name]['nullable'] = !$notNullable; } + $generated = false; + if (isset($value['identity']) && $value['identity'] === true) { + $generated = true; + } $method = $this->snakeCaseToUpperCamelCase($name); $getter = $class->addMethod('get' . $method) ->addComment('Get ' . str_replace('_', ' ', $name)) @@ -76,7 +80,7 @@ public function genModel( if ($typehint) { $getter->setReturnType($this->convertType($value['type'])); - $getter->setReturnNullable(!$notNullable); + $getter->setReturnNullable($generated ? true : !$notNullable); $setter->setReturnType('self'); $setParam->setType($this->convertType($value['type'])); @@ -102,6 +106,11 @@ public function genModel( $item = current($pk); $itemName = current(array_keys($pk)); + $generated = false; + if (isset($item['identity']) && $item['identity'] === true) { + $generated = true; + } + $getId = $class ->addMethod('getId') ->addComment('Get ID') @@ -109,7 +118,7 @@ public function genModel( ->setBody('return $this->getData(self::' . strtoupper($itemName) . ');'); if ($typehint) { $getId->setReturnType($this->convertType($item['type'])); - $getId->setReturnNullable($item['nullable']); + $getId->setReturnNullable($generated ? true : $item['nullable']); } $setId = $class diff --git a/src/Jeeves/Generators/Crud/Ui/Edit.php b/src/Jeeves/Generators/Crud/Ui/Edit.php index 1271653..5c1aeb6 100644 --- a/src/Jeeves/Generators/Crud/Ui/Edit.php +++ b/src/Jeeves/Generators/Crud/Ui/Edit.php @@ -25,190 +25,14 @@ public function generateAdminUiForm( if ($withStore) { $fields['store_id'] = [ 'type' => 'store', + 'nullable' => false, ]; } - $fieldset = array_map( - function ($name, $param) use ($entity, $primary) { - $notNullable = isset($param['nullable']) && $param['nullable'] === false; - - $visible = true; - if ($primary === $this->camelCaseToSnakeCase($name)) { - $visible = false; - } - - if (in_array($name, self::IGNORED_FIELDS)) { - $visible = false; - $notNullable = false; - } - - switch ($param['type']) { - case 'text': - case 'mediumtext': - case 'longtext': - $dataType = 'text'; - $formElement = 'textarea'; - break; - case 'store': - $dataType = 'int'; - $formElement = 'multiselect'; - break; - case 'smallint': - case 'bigint': - case 'tinyint': - case 'int': - $dataType = 'text'; - $formElement = 'input'; - break; - case 'date': - case 'datetime': - case 'timestamp': - $dataType = 'date'; - $formElement = 'input'; - break; - case 'bool': - case 'boolean': - $dataType = 'boolean'; - $formElement = 'checkbox'; - break; - case 'price': - $dataType = 'price'; - $formElement = 'input'; - break; - default: - $dataType = 'text'; - $formElement = 'input'; - } - if (isset($param['source'])) { - $formElement = 'select'; - } - $field = [ - 'name' => 'field', - 'attributes' => [ - 'name' => $this->camelCaseToSnakeCase($name), - 'formElement' => $formElement, - ], - 'value' => [ - 'argument' => [ - 'attributes' => [ - 'name' => 'data', - 'xsi:type' => 'array', - ], - 'value' => [ - 'item' => [ - 'attributes' => [ - 'name' => 'config', - 'xsi:type' => 'array', - ], - 'value' => [ - 'item' => [ - 'attributes' => [ - 'name' => 'source', - 'xsi:type' => 'string', - ], - 'value' => str_replace('_', '', $this->camelCaseToSnakeCase($entity)), - ], - ], - ], - ], - ], - 'settings' => [ - 'dataType' => $dataType, - 'label' => [ - 'attributes' => [ - 'translate' => 'true', - ], - 'value' => $this->snakeCaseToUpperCamelCaseWithSpace($name), - ], - 'visible' => $visible ? 'true' : 'false', - 'dataScope' => $this->camelCaseToSnakeCase($name), - ], - ], - ]; - switch ($param['type']) { - case 'bool': - case 'boolean': - $field['value']['formElements'] = [ - 'checkbox' => [ - 'settings' => [ - 'valueMap' => [ - [ - [ - 'map' => [ - 'attributes' => [ - 'name' => 'false', - 'xsi:type' => 'number', - ], - 'value' => 0, - ], - ], - [ - 'map' => [ - 'attributes' => [ - 'name' => 'true', - 'xsi:type' => 'number', - ], - 'value' => 1, - ], - ], - ], - ], - 'prefer' => 'toggle', - ], - ], - ]; - break; - case 'store': - $field['attributes']['class'] = 'Magento\Store\Ui\Component\Form\Field\StoreView'; - $field['value']['formElements'] = [ - 'multiselect' => [ - 'settings' => [ - 'options' => [ - 'attributes' => [ - 'class' => 'Magento\Store\Ui\Component\Listing\Column\Store\Options', - ], - ], - ], - ], - ]; - break; - default: - if ($notNullable) { - $field['value']['settings']['validation']['rule'] = [ - 'attributes' => [ - 'name' => 'required-entry', - 'xsi:type' => 'boolean', - ], - 'value' => 'true', - ]; - } - break; - } - if (isset($param['source'])) { - $field['value']['formElements'] = [ - 'select' => [ - 'settings' => [ - 'options' => [ - 'attributes' => [ - 'class' => $param['source'], - ], - ], - 'caption' => [ - 'attributes' => [ - 'translate' => 'true', - ], - 'value' => '-- Please Select --', - ], - ], - ], - ]; - } - - return $field; - }, - array_keys($fields), - $fields - ); + $fieldset = []; + foreach ($fields as $name => $param) { + $fieldset[] = $this->getField($name, $param, $entity, $primary); + } return $service->write('form', function ($writer) use ($uiComponent, $dataSource, $submit, $provider, $fieldset, $primary) { $writer->writeAttribute( @@ -219,44 +43,44 @@ function ($name, $param) use ($entity, $primary) { $writer->write([ [ 'argument' => [ - 'attributes' => [ - 'name' => 'data', + self::A => [ + self::N => 'data', 'xsi:type' => 'array', ], - 'value' => [ + self::V => [ [ 'item' => [ - 'attributes' => [ - 'name' => 'js_config', + self::A => [ + self::N => 'js_config', 'xsi:type' => 'array', ], - 'value' => [ + self::V => [ [ - 'name' => 'item', - 'attributes' => [ - 'name' => 'provider', + self::N => 'item', + self::A => [ + self::N => 'provider', 'xsi:type' => 'string', ], - 'value' => $uiComponent . '.' . $dataSource, + self::V => $uiComponent . '.' . $dataSource, ], ], ], [ - 'name' => 'item', - 'attributes' => [ - 'name' => 'label', + self::N => 'item', + self::A => [ + self::N => 'label', 'xsi:type' => 'string', 'translate' => 'true', ], - 'value' => 'General Information', + self::V => 'General Information', ], [ - 'name' => 'item', - 'attributes' => [ - 'name' => 'template', + self::N => 'item', + self::A => [ + self::N => 'template', 'xsi:type' => 'string', ], - 'value' => 'templates/form/collapsible', + self::V => 'templates/form/collapsible', ], ], ], @@ -264,37 +88,37 @@ function ($name, $param) use ($entity, $primary) { 'settings' => [ 'buttons' => [ [ - 'name' => 'button', - 'attributes' => [ - 'name' => 'save_and_continue', + self::N => 'button', + self::A => [ + self::N => 'save_and_continue', 'class' => 'Mygento\Base\Block\Adminhtml\Component\Edit\SaveAndContinueButton', ], ], [ - 'name' => 'button', - 'attributes' => [ - 'name' => 'save', + self::N => 'button', + self::A => [ + self::N => 'save', 'class' => 'Mygento\Base\Block\Adminhtml\Component\Edit\SaveButton', ], ], [ - 'name' => 'button', - 'attributes' => [ - 'name' => 'reset', + self::N => 'button', + self::A => [ + self::N => 'reset', 'class' => 'Mygento\Base\Block\Adminhtml\Component\Edit\ResetButton', ], ], [ - 'name' => 'button', - 'attributes' => [ - 'name' => 'delete', + self::N => 'button', + self::A => [ + self::N => 'delete', 'class' => 'Mygento\Base\Block\Adminhtml\Component\Edit\DeleteButton', ], ], [ - 'name' => 'button', - 'attributes' => [ - 'name' => 'back', + self::N => 'button', + self::A => [ + self::N => 'back', 'class' => 'Mygento\Base\Block\Adminhtml\Component\Edit\BackButton', ], ], @@ -306,30 +130,30 @@ function ($name, $param) use ($entity, $primary) { ], ], 'dataSource' => [ - 'attributes' => [ - 'name' => $dataSource, + self::A => [ + self::N => $dataSource, ], - 'value' => [ + self::V => [ 'argument' => [ - 'attributes' => [ - 'name' => 'data', + self::A => [ + self::N => 'data', 'xsi:type' => 'array', ], - 'value' => [ + self::V => [ [ 'item' => [ - 'attributes' => [ - 'name' => 'js_config', + self::A => [ + self::N => 'js_config', 'xsi:type' => 'array', ], - 'value' => [ + self::V => [ [ 'item' => [ - 'attributes' => [ - 'name' => 'component', + self::A => [ + self::N => 'component', 'xsi:type' => 'string', ], - 'value' => 'Magento_Ui/js/form/provider', + self::V => 'Magento_Ui/js/form/provider', ], ], ], @@ -339,17 +163,17 @@ function ($name, $param) use ($entity, $primary) { ], 'settings' => [ 'submitUrl' => [ - 'attributes' => [ + self::A => [ 'path' => $submit, ], ], ], 'dataProvider' => [ - 'attributes' => [ - 'name' => $dataSource, + self::A => [ + self::N => $dataSource, 'class' => $provider, ], - 'value' => [ + self::V => [ 'settings' => [ 'requestFieldName' => 'id', 'primaryFieldName' => $primary, @@ -359,10 +183,10 @@ function ($name, $param) use ($entity, $primary) { ], ], 'fieldset' => [ - 'attributes' => [ - 'name' => 'general', + self::A => [ + self::N => 'general', ], - 'value' => array_merge([ + self::V => array_merge([ 'settings' => [ 'label' => '', ], @@ -372,4 +196,241 @@ function ($name, $param) use ($entity, $primary) { ]); }); } + + private function getField(string $name, array $param, string $entity, string $primary): array + { + $notNullable = isset($param['nullable']) && $param['nullable'] === false; + + $visible = true; + if ($primary === $this->camelCaseToSnakeCase($name)) { + $visible = false; + } + + if (in_array($name, self::IGNORED_FIELDS)) { + $visible = false; + $notNullable = false; + } + + switch ($param['type']) { + case 'text': + case 'mediumtext': + case 'longtext': + $dataType = 'text'; + $formElement = 'textarea'; + break; + case 'store': + $dataType = 'int'; + $formElement = 'multiselect'; + break; + case 'smallint': + case 'bigint': + case 'tinyint': + case 'int': + $dataType = 'text'; + $formElement = 'input'; + break; + case 'date': + case 'datetime': + case 'timestamp': + $dataType = 'date'; + $formElement = 'input'; + break; + case 'bool': + case 'boolean': + $dataType = 'boolean'; + $formElement = 'checkbox'; + break; + case 'price': + $dataType = 'price'; + $formElement = 'input'; + break; + default: + $dataType = 'text'; + $formElement = 'input'; + } + if (isset($param['source'])) { + $formElement = 'select'; + } + $field = [ + self::N => 'field', + self::A => [ + self::N => $this->camelCaseToSnakeCase($name), + 'formElement' => $formElement, + ], + self::V => [ + 'argument' => [ + self::A => [ + self::N => 'data', + 'xsi:type' => 'array', + ], + self::V => [ + 'item' => [ + self::A => [ + self::N => 'config', + 'xsi:type' => 'array', + ], + self::V => [ + 'item' => [ + self::A => [ + self::N => 'source', + 'xsi:type' => 'string', + ], + self::V => str_replace('_', '', $this->camelCaseToSnakeCase($entity)), + ], + ], + ], + ], + ], + 'settings' => [ + 'dataType' => $dataType, + 'label' => [ + self::A => [ + 'translate' => 'true', + ], + self::V => $this->snakeCaseToUpperCamelCaseWithSpace($name), + ], + 'visible' => $visible ? 'true' : 'false', + 'dataScope' => $this->camelCaseToSnakeCase($name), + ], + ], + ]; + + return $this->setValidation( + $this->setFormElements($field, $param), + $param, + $notNullable, + $visible + ); + } + + private function setFormElements(array $field, array $param): array + { + switch ($param['type']) { + case 'bool': + case 'boolean': + $field[self::V]['formElements'] = [ + 'checkbox' => [ + 'settings' => [ + 'valueMap' => [ + [ + [ + 'map' => [ + self::A => [ + self::N => 'false', + 'xsi:type' => 'number', + ], + self::V => 0, + ], + ], + [ + 'map' => [ + self::A => [ + self::N => 'true', + 'xsi:type' => 'number', + ], + self::V => 1, + ], + ], + ], + ], + 'prefer' => 'toggle', + ], + ], + ]; + break; + case 'store': + $field[self::A]['class'] = 'Magento\Store\Ui\Component\Form\Field\StoreView'; + $field[self::V]['formElements'] = [ + 'multiselect' => [ + 'settings' => [ + 'options' => [ + self::A => [ + 'class' => 'Magento\Store\Ui\Component\Listing\Column\Store\Options', + ], + ], + ], + ], + ]; + break; + default: + break; + } + + if (isset($param['source'])) { + $field[self::V]['formElements'] = [ + 'select' => [ + 'settings' => [ + 'options' => [ + self::A => [ + 'class' => $param['source'], + ], + ], + 'caption' => [ + self::A => [ + 'translate' => 'true', + ], + self::V => '-- Please Select --', + ], + ], + ], + ]; + } + + return $field; + } + + private function setValidation(array $field, array $param, bool $notNullable, bool $visible): array + { + if (!$visible) { + return $field; + } + $rules = []; + switch ($param['type']) { + case 'bool': + case 'boolean': + return $field; + case 'smallint': + case 'bigint': + case 'tinyint': + case 'int': + $rules[] = [ + self::N => 'rule', + self::A => [ + self::N => 'validate-integer', + 'xsi:type' => 'boolean', + ], + self::V => 'true', + ]; + if (isset($param['unsigned']) && $param['unsigned'] === true) { + $rules[] = [ + self::N => 'rule', + self::A => [ + self::N => 'validate-zero-or-greater', + 'xsi:type' => 'boolean', + ], + self::V => 'true', + ]; + } + break; + default: + break; + } + + if ($notNullable) { + $rules[] = [ + self::N => 'rule', + self::A => [ + self::N => 'required-entry', + 'xsi:type' => 'boolean', + ], + self::V => 'true', + ]; + } + + if (!empty($rules)) { + $field[self::V]['settings']['validation'] = $rules; + } + + return $field; + } } diff --git a/src/Jeeves/Generators/Crud/Ui/Grid.php b/src/Jeeves/Generators/Crud/Ui/Grid.php index 5b71a10..8870408 100644 --- a/src/Jeeves/Generators/Crud/Ui/Grid.php +++ b/src/Jeeves/Generators/Crud/Ui/Grid.php @@ -37,7 +37,7 @@ public function generateGridCollection( } $construct = $class->addMethod('__construct'); - if ($withStore) { + if ($withStore && !$typehint) { $construct->addComment('@param \Magento\Framework\EntityManager\MetadataPool $metadataPool'); } $construct @@ -83,9 +83,10 @@ public function generateGridCollection( ->addComment('@param string $model') ->addComment('@param \Magento\Framework\DB\Adapter\AdapterInterface|string|null $connection') ->addComment('@param \Magento\Framework\Model\ResourceModel\Db\AbstractDb|null $resource'); - $construct->addComment('@SuppressWarnings(PHPMD.ExcessiveParameterList)'); } + $construct->addComment('@SuppressWarnings(PHPMD.ExcessiveParameterList)'); + $construct->setBody('parent::__construct(' . PHP_EOL . ($withStore ? '$metadataPool,' . PHP_EOL : '') . ' $entityFactory,' . PHP_EOL diff --git a/src/Jeeves/Generators/Crud/Ui/Listing.php b/src/Jeeves/Generators/Crud/Ui/Listing.php index e00a67f..90f020d 100644 --- a/src/Jeeves/Generators/Crud/Ui/Listing.php +++ b/src/Jeeves/Generators/Crud/Ui/Listing.php @@ -33,126 +33,10 @@ public function generateAdminUiIndex( 'type' => 'store', ]; } - $columns = array_map( - function ($name, $param) use ($primaryKey) { - $notNullable = isset($param['nullable']) && $param['nullable'] === false; - $options = null; - switch ($param['type']) { - case 'bool': - case 'boolean': - $filter = 'select'; - $dataType = 'select'; - $options = 'Magento\Config\Model\Config\Source\Yesno'; - break; - case 'smallint': - case 'bigint': - case 'tinyint': - case 'int': - $filter = 'textRange'; - $dataType = 'text'; - - break; - case 'price': - $filter = 'textRange'; - $dataType = 'text'; - break; - case 'date': - case 'datetime': - case 'timestamp': - $filter = 'dateRange'; - $dataType = 'date'; - break; - default: - $filter = 'text'; - $dataType = 'text'; - } - if (isset($param['source'])) { - $filter = 'select'; - $dataType = 'select'; - } - $col = [ - self::N => 'column', - self::A => [ - 'name' => $name, - ], - self::V => [ - 'settings' => [ - 'filter' => $filter, - 'dataType' => $dataType, - 'editor' => [ - 'editorType' => $dataType, - ], - 'label' => [ - self::A => [ - 'translate' => 'true', - ], - self::V => $this->snakeCaseToUpperCamelCaseWithSpace($name), - ], - ], - ], - ]; - if ($primaryKey === $name) { - unset($col[self::V]['settings']['editor']); - $col[self::V]['settings']['sorting'] = 'asc'; - } - switch ($param['type']) { - case 'bool': - case 'boolean': - $col[self::A]['component'] = 'Magento_Ui/js/grid/columns/select'; - $col[self::V]['settings']['options'] = [ - self::A => [ - 'class' => $options, - ], - ]; - break; - case 'price': - $col[self::A]['class'] = 'Magento\Catalog\Ui\Component\Listing\Columns\Price'; - break; - case 'date': - case 'datetime': - case 'timestamp': - $col[self::A]['class'] = 'Magento\Ui\Component\Listing\Columns\Date'; - $col[self::A]['component'] = 'Magento_Ui/js/grid/columns/date'; - break; - case 'store': - $col[self::A]['class'] = 'Magento\Store\Ui\Component\Listing\Column\Store'; - $col[self::V]['settings']['label'][self::V] = 'Store View'; - $col[self::V]['settings']['bodyTmpl'] = 'ui/grid/cells/html'; - $col[self::V]['settings']['sortable'] = 'false'; - unset($col[self::V]['settings']['filter']); - unset($col[self::V]['settings']['dataType']); - unset($col[self::V]['settings']['editor']); - break; - default: - break; - } - if ($notNullable) { - $col[self::V]['settings']['editor']['validation']['rule'] = [ - self::A => [ - 'name' => 'required-entry', - 'xsi:type' => 'boolean', - ], - self::V => 'true', - ]; - } - if (isset($param['source'])) { - $col[self::A]['component'] = 'Magento_Ui/js/grid/columns/select'; - $col[self::V]['settings']['options'] = [ - self::A => [ - 'class' => $param['source'], - ], - ]; - } - - if (in_array($name, self::READONLY_FIELDS)) { - unset($col[self::V]['settings']['editor']); - } - - return $col; - }, - array_keys($fields), - $fields - ); + $columns = []; + foreach ($fields as $name => $param) { + $columns[] = $this->getColumn($name, $param, $primaryKey); + } return $service->write('listing', function ($writer) use ( $columns, @@ -552,4 +436,174 @@ private function getToolbar($massDelete, $editor, $readonly) ], ]; } + + private function getColumn(string $name, array $param, string $primaryKey): array + { + $notNullable = isset($param['nullable']) && $param['nullable'] === false; + $options = null; + switch ($param['type']) { + case 'bool': + case 'boolean': + $filter = 'select'; + $dataType = 'select'; + $options = 'Magento\Config\Model\Config\Source\Yesno'; + break; + case 'smallint': + case 'bigint': + case 'tinyint': + case 'int': + $filter = 'textRange'; + $dataType = 'text'; + + break; + case 'price': + $filter = 'textRange'; + $dataType = 'text'; + break; + case 'date': + case 'datetime': + case 'timestamp': + $filter = 'dateRange'; + $dataType = 'date'; + break; + default: + $filter = 'text'; + $dataType = 'text'; + } + if (isset($param['source'])) { + $filter = 'select'; + $dataType = 'select'; + } + $col = [ + self::N => 'column', + self::A => [ + 'name' => $name, + ], + self::V => [ + 'settings' => [ + 'filter' => $filter, + 'dataType' => $dataType, + 'editor' => [ + 'editorType' => $dataType, + ], + 'label' => [ + self::A => [ + 'translate' => 'true', + ], + self::V => $this->snakeCaseToUpperCamelCaseWithSpace($name), + ], + ], + ], + ]; + + $col = $this->setComponent($col, $param, $options); + $col = $this->setValidation($col, $param, $notNullable); + + if ($primaryKey === $name) { + unset($col[self::V]['settings']['editor']); + $col[self::V]['settings']['sorting'] = 'asc'; + } + + if (in_array($name, self::READONLY_FIELDS)) { + unset($col[self::V]['settings']['editor']); + } + + return $col; + } + + private function setComponent(array $col, array $param, ?string $options): array + { + switch ($param['type']) { + case 'bool': + case 'boolean': + $col[self::A]['component'] = 'Magento_Ui/js/grid/columns/select'; + $col[self::V]['settings']['options'] = [ + self::A => [ + 'class' => $options, + ], + ]; + break; + case 'price': + $col[self::A]['class'] = 'Magento\Catalog\Ui\Component\Listing\Columns\Price'; + break; + case 'date': + case 'datetime': + case 'timestamp': + $col[self::A]['class'] = 'Magento\Ui\Component\Listing\Columns\Date'; + $col[self::A]['component'] = 'Magento_Ui/js/grid/columns/date'; + break; + case 'store': + $col[self::A]['class'] = 'Magento\Store\Ui\Component\Listing\Column\Store'; + $col[self::V]['settings']['label'][self::V] = 'Store View'; + $col[self::V]['settings']['bodyTmpl'] = 'ui/grid/cells/html'; + $col[self::V]['settings']['sortable'] = 'false'; + unset($col[self::V]['settings']['filter']); + unset($col[self::V]['settings']['dataType']); + unset($col[self::V]['settings']['editor']); + break; + default: + break; + } + + if (isset($param['source'])) { + $col[self::A]['component'] = 'Magento_Ui/js/grid/columns/select'; + $col[self::V]['settings']['options'] = [ + self::A => [ + 'class' => $param['source'], + ], + ]; + } + + return $col; + } + + private function setValidation(array $col, array $param, bool $notNullable): array + { + $rules = []; + + switch ($param['type']) { + case 'smallint': + case 'bigint': + case 'tinyint': + case 'int': + $rules[] = [ + self::N => 'rule', + self::A => [ + self::N => 'validate-integer', + 'xsi:type' => 'boolean', + ], + self::V => 'true', + ]; + if (isset($param['unsigned']) && $param['unsigned'] === true) { + $rules[] = [ + self::N => 'rule', + self::A => [ + self::N => 'validate-zero-or-greater', + 'xsi:type' => 'boolean', + ], + self::V => 'true', + ]; + } + break; + default: + break; + } + + if ($notNullable) { + $rules[] = [ + self::N => 'rule', + self::A => [ + self::N => 'required-entry', + 'xsi:type' => 'boolean', + ], + self::V => 'true', + ]; + } + + if (!empty($rules)) { + $col[self::V]['settings']['editor']['validation'] = $rules; + } + + return $col; + } } diff --git a/test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress/Edit.php b/test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress/Edit.php index eca0a70..2d1c4de 100644 --- a/test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress/Edit.php +++ b/test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress/Edit.php @@ -65,7 +65,7 @@ public function execute() ); $resultPage->getConfig()->getTitle()->prepend(__('Customer Address')->render()); $resultPage->getConfig()->getTitle()->prepend( - $entity->getId() ? $entity->getTitle() : __('New Customer Address')->render() + $entityId ? $entity->getTitle() : __('New Customer Address')->render() ); return $resultPage; diff --git a/test/Expectations/Crud/74/v0/view/adminhtml/ui_component/sample_module_banner_listing.xml b/test/Expectations/Crud/74/v0/view/adminhtml/ui_component/sample_module_banner_listing.xml index de1d752..ef26c13 100644 --- a/test/Expectations/Crud/74/v0/view/adminhtml/ui_component/sample_module_banner_listing.xml +++ b/test/Expectations/Crud/74/v0/view/adminhtml/ui_component/sample_module_banner_listing.xml @@ -104,6 +104,10 @@ text text + + true + true + diff --git a/test/Expectations/Crud/74/v0/view/adminhtml/ui_component/sample_module_customeraddress_edit.xml b/test/Expectations/Crud/74/v0/view/adminhtml/ui_component/sample_module_customeraddress_edit.xml index 7c07156..d27ec14 100644 --- a/test/Expectations/Crud/74/v0/view/adminhtml/ui_component/sample_module_customeraddress_edit.xml +++ b/test/Expectations/Crud/74/v0/view/adminhtml/ui_component/sample_module_customeraddress_edit.xml @@ -82,6 +82,7 @@ true customer_group + true true diff --git a/test/Expectations/Crud/74/v0/view/adminhtml/ui_component/sample_module_customeraddress_listing.xml b/test/Expectations/Crud/74/v0/view/adminhtml/ui_component/sample_module_customeraddress_listing.xml index 9f3d6af..2e16861 100644 --- a/test/Expectations/Crud/74/v0/view/adminhtml/ui_component/sample_module_customeraddress_listing.xml +++ b/test/Expectations/Crud/74/v0/view/adminhtml/ui_component/sample_module_customeraddress_listing.xml @@ -132,6 +132,7 @@ select + true true diff --git a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Card/Edit.php b/test/Expectations/Crud/74/v1/Controller/Adminhtml/Card/Edit.php index dd753fd..126fcf3 100644 --- a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Card/Edit.php +++ b/test/Expectations/Crud/74/v1/Controller/Adminhtml/Card/Edit.php @@ -60,7 +60,7 @@ public function execute(): ResultInterface ); $resultPage->getConfig()->getTitle()->prepend(__('Card')->render()); $resultPage->getConfig()->getTitle()->prepend( - $entity->getId() ? $entity->getTitle() : __('New Card')->render() + $entityId ? $entity->getTitle() : __('New Card')->render() ); return $resultPage; diff --git a/test/Expectations/Crud/74/v1/Controller/Adminhtml/CartItem/Edit.php b/test/Expectations/Crud/74/v1/Controller/Adminhtml/CartItem/Edit.php index 5f9951f..888910f 100644 --- a/test/Expectations/Crud/74/v1/Controller/Adminhtml/CartItem/Edit.php +++ b/test/Expectations/Crud/74/v1/Controller/Adminhtml/CartItem/Edit.php @@ -60,7 +60,7 @@ public function execute(): ResultInterface ); $resultPage->getConfig()->getTitle()->prepend(__('Cart Item')->render()); $resultPage->getConfig()->getTitle()->prepend( - $entity->getId() ? $entity->getTitle() : __('New Cart Item')->render() + $entityId ? $entity->getTitle() : __('New Cart Item')->render() ); return $resultPage; diff --git a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Columns/Edit.php b/test/Expectations/Crud/74/v1/Controller/Adminhtml/Columns/Edit.php index 2a87f61..17e77c2 100644 --- a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Columns/Edit.php +++ b/test/Expectations/Crud/74/v1/Controller/Adminhtml/Columns/Edit.php @@ -60,7 +60,7 @@ public function execute(): ResultInterface ); $resultPage->getConfig()->getTitle()->prepend(__('Columns')->render()); $resultPage->getConfig()->getTitle()->prepend( - $entity->getId() ? $entity->getTitle() : __('New Columns')->render() + $entityId ? $entity->getTitle() : __('New Columns')->render() ); return $resultPage; diff --git a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Obsolete/Edit.php b/test/Expectations/Crud/74/v1/Controller/Adminhtml/Obsolete/Edit.php index e374942..ab45862 100644 --- a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Obsolete/Edit.php +++ b/test/Expectations/Crud/74/v1/Controller/Adminhtml/Obsolete/Edit.php @@ -65,7 +65,7 @@ public function execute() ); $resultPage->getConfig()->getTitle()->prepend(__('Obsolete')->render()); $resultPage->getConfig()->getTitle()->prepend( - $entity->getId() ? $entity->getTitle() : __('New Obsolete')->render() + $entityId ? $entity->getTitle() : __('New Obsolete')->render() ); return $resultPage; diff --git a/test/Expectations/Crud/74/v1/Model/ResourceModel/Card/Grid/Collection.php b/test/Expectations/Crud/74/v1/Model/ResourceModel/Card/Grid/Collection.php index aa3f61d..a87573a 100644 --- a/test/Expectations/Crud/74/v1/Model/ResourceModel/Card/Grid/Collection.php +++ b/test/Expectations/Crud/74/v1/Model/ResourceModel/Card/Grid/Collection.php @@ -19,7 +19,7 @@ class Collection extends ParentCollection implements SearchResultInterface protected AggregationInterface $aggregations; /** - * @param \Magento\Framework\EntityManager\MetadataPool $metadataPool + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( MetadataPool $metadataPool, diff --git a/test/Expectations/Crud/74/v1/Model/ResourceModel/CartItem/Grid/Collection.php b/test/Expectations/Crud/74/v1/Model/ResourceModel/CartItem/Grid/Collection.php index 04c5cc9..243d212 100644 --- a/test/Expectations/Crud/74/v1/Model/ResourceModel/CartItem/Grid/Collection.php +++ b/test/Expectations/Crud/74/v1/Model/ResourceModel/CartItem/Grid/Collection.php @@ -17,6 +17,9 @@ class Collection extends ParentCollection implements SearchResultInterface { protected AggregationInterface $aggregations; + /** + * @SuppressWarnings(PHPMD.ExcessiveParameterList) + */ public function __construct( EntityFactoryInterface $entityFactory, LoggerInterface $logger, diff --git a/test/Expectations/Crud/74/v1/Model/ResourceModel/Columns/Grid/Collection.php b/test/Expectations/Crud/74/v1/Model/ResourceModel/Columns/Grid/Collection.php index 6749cb5..e612fcf 100644 --- a/test/Expectations/Crud/74/v1/Model/ResourceModel/Columns/Grid/Collection.php +++ b/test/Expectations/Crud/74/v1/Model/ResourceModel/Columns/Grid/Collection.php @@ -17,6 +17,9 @@ class Collection extends ParentCollection implements SearchResultInterface { protected AggregationInterface $aggregations; + /** + * @SuppressWarnings(PHPMD.ExcessiveParameterList) + */ public function __construct( EntityFactoryInterface $entityFactory, LoggerInterface $logger, diff --git a/test/Expectations/Crud/74/v1/Model/ResourceModel/Poster/Grid/Collection.php b/test/Expectations/Crud/74/v1/Model/ResourceModel/Poster/Grid/Collection.php index c5dfe4f..e678daa 100644 --- a/test/Expectations/Crud/74/v1/Model/ResourceModel/Poster/Grid/Collection.php +++ b/test/Expectations/Crud/74/v1/Model/ResourceModel/Poster/Grid/Collection.php @@ -17,6 +17,9 @@ class Collection extends ParentCollection implements SearchResultInterface { protected AggregationInterface $aggregations; + /** + * @SuppressWarnings(PHPMD.ExcessiveParameterList) + */ public function __construct( EntityFactoryInterface $entityFactory, LoggerInterface $logger, diff --git a/test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_card_edit.xml b/test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_card_edit.xml index a497670..d69f963 100644 --- a/test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_card_edit.xml +++ b/test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_card_edit.xml @@ -92,6 +92,7 @@ true category_id + true true @@ -131,6 +132,9 @@ true store_id + + true + diff --git a/test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_card_listing.xml b/test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_card_listing.xml index 2da925c..ac4e3e8 100644 --- a/test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_card_listing.xml +++ b/test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_card_listing.xml @@ -139,6 +139,7 @@ text + true true diff --git a/test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_cartitem_edit.xml b/test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_cartitem_edit.xml index ec07ef1..9277edd 100644 --- a/test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_cartitem_edit.xml +++ b/test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_cartitem_edit.xml @@ -119,6 +119,7 @@ true customer_group + true true diff --git a/test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_cartitem_listing.xml b/test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_cartitem_listing.xml index fc18439..d67c190 100644 --- a/test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_cartitem_listing.xml +++ b/test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_cartitem_listing.xml @@ -153,6 +153,7 @@ select + true true diff --git a/test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_poster_listing.xml b/test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_poster_listing.xml index 72ee234..37c8a22 100644 --- a/test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_poster_listing.xml +++ b/test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_poster_listing.xml @@ -104,6 +104,10 @@ text text + + true + true + diff --git a/test/Expectations/Crud/81/v1/Controller/Adminhtml/Card/Edit.php b/test/Expectations/Crud/81/v1/Controller/Adminhtml/Card/Edit.php index 6cac1d4..4c09471 100644 --- a/test/Expectations/Crud/81/v1/Controller/Adminhtml/Card/Edit.php +++ b/test/Expectations/Crud/81/v1/Controller/Adminhtml/Card/Edit.php @@ -54,7 +54,7 @@ public function execute(): ResultInterface ); $resultPage->getConfig()->getTitle()->prepend(__('Card')->render()); $resultPage->getConfig()->getTitle()->prepend( - $entity->getId() ? $entity->getTitle() : __('New Card')->render() + $entityId ? $entity->getTitle() : __('New Card')->render() ); return $resultPage; diff --git a/test/Expectations/Crud/81/v1/Controller/Adminhtml/CartItem/Edit.php b/test/Expectations/Crud/81/v1/Controller/Adminhtml/CartItem/Edit.php index b178abf..adb8544 100644 --- a/test/Expectations/Crud/81/v1/Controller/Adminhtml/CartItem/Edit.php +++ b/test/Expectations/Crud/81/v1/Controller/Adminhtml/CartItem/Edit.php @@ -54,7 +54,7 @@ public function execute(): ResultInterface ); $resultPage->getConfig()->getTitle()->prepend(__('Cart Item')->render()); $resultPage->getConfig()->getTitle()->prepend( - $entity->getId() ? $entity->getTitle() : __('New Cart Item')->render() + $entityId ? $entity->getTitle() : __('New Cart Item')->render() ); return $resultPage; diff --git a/test/Expectations/Crud/81/v1/Controller/Adminhtml/Columns/Edit.php b/test/Expectations/Crud/81/v1/Controller/Adminhtml/Columns/Edit.php index d87ad2a..a6806d0 100644 --- a/test/Expectations/Crud/81/v1/Controller/Adminhtml/Columns/Edit.php +++ b/test/Expectations/Crud/81/v1/Controller/Adminhtml/Columns/Edit.php @@ -54,7 +54,7 @@ public function execute(): ResultInterface ); $resultPage->getConfig()->getTitle()->prepend(__('Columns')->render()); $resultPage->getConfig()->getTitle()->prepend( - $entity->getId() ? $entity->getTitle() : __('New Columns')->render() + $entityId ? $entity->getTitle() : __('New Columns')->render() ); return $resultPage; diff --git a/test/Expectations/Crud/81/v1/Controller/Adminhtml/Obsolete/Edit.php b/test/Expectations/Crud/81/v1/Controller/Adminhtml/Obsolete/Edit.php index e374942..ab45862 100644 --- a/test/Expectations/Crud/81/v1/Controller/Adminhtml/Obsolete/Edit.php +++ b/test/Expectations/Crud/81/v1/Controller/Adminhtml/Obsolete/Edit.php @@ -65,7 +65,7 @@ public function execute() ); $resultPage->getConfig()->getTitle()->prepend(__('Obsolete')->render()); $resultPage->getConfig()->getTitle()->prepend( - $entity->getId() ? $entity->getTitle() : __('New Obsolete')->render() + $entityId ? $entity->getTitle() : __('New Obsolete')->render() ); return $resultPage; diff --git a/test/Expectations/Crud/81/v1/Model/ResourceModel/Card/Grid/Collection.php b/test/Expectations/Crud/81/v1/Model/ResourceModel/Card/Grid/Collection.php index aa3f61d..a87573a 100644 --- a/test/Expectations/Crud/81/v1/Model/ResourceModel/Card/Grid/Collection.php +++ b/test/Expectations/Crud/81/v1/Model/ResourceModel/Card/Grid/Collection.php @@ -19,7 +19,7 @@ class Collection extends ParentCollection implements SearchResultInterface protected AggregationInterface $aggregations; /** - * @param \Magento\Framework\EntityManager\MetadataPool $metadataPool + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( MetadataPool $metadataPool, diff --git a/test/Expectations/Crud/81/v1/Model/ResourceModel/CartItem/Grid/Collection.php b/test/Expectations/Crud/81/v1/Model/ResourceModel/CartItem/Grid/Collection.php index 04c5cc9..243d212 100644 --- a/test/Expectations/Crud/81/v1/Model/ResourceModel/CartItem/Grid/Collection.php +++ b/test/Expectations/Crud/81/v1/Model/ResourceModel/CartItem/Grid/Collection.php @@ -17,6 +17,9 @@ class Collection extends ParentCollection implements SearchResultInterface { protected AggregationInterface $aggregations; + /** + * @SuppressWarnings(PHPMD.ExcessiveParameterList) + */ public function __construct( EntityFactoryInterface $entityFactory, LoggerInterface $logger, diff --git a/test/Expectations/Crud/81/v1/Model/ResourceModel/Columns/Grid/Collection.php b/test/Expectations/Crud/81/v1/Model/ResourceModel/Columns/Grid/Collection.php index 6749cb5..e612fcf 100644 --- a/test/Expectations/Crud/81/v1/Model/ResourceModel/Columns/Grid/Collection.php +++ b/test/Expectations/Crud/81/v1/Model/ResourceModel/Columns/Grid/Collection.php @@ -17,6 +17,9 @@ class Collection extends ParentCollection implements SearchResultInterface { protected AggregationInterface $aggregations; + /** + * @SuppressWarnings(PHPMD.ExcessiveParameterList) + */ public function __construct( EntityFactoryInterface $entityFactory, LoggerInterface $logger, diff --git a/test/Expectations/Crud/81/v1/Model/ResourceModel/Poster/Grid/Collection.php b/test/Expectations/Crud/81/v1/Model/ResourceModel/Poster/Grid/Collection.php index c5dfe4f..e678daa 100644 --- a/test/Expectations/Crud/81/v1/Model/ResourceModel/Poster/Grid/Collection.php +++ b/test/Expectations/Crud/81/v1/Model/ResourceModel/Poster/Grid/Collection.php @@ -17,6 +17,9 @@ class Collection extends ParentCollection implements SearchResultInterface { protected AggregationInterface $aggregations; + /** + * @SuppressWarnings(PHPMD.ExcessiveParameterList) + */ public function __construct( EntityFactoryInterface $entityFactory, LoggerInterface $logger, diff --git a/test/Expectations/Crud/81/v1/view/adminhtml/ui_component/sample_module_card_edit.xml b/test/Expectations/Crud/81/v1/view/adminhtml/ui_component/sample_module_card_edit.xml index a497670..d69f963 100644 --- a/test/Expectations/Crud/81/v1/view/adminhtml/ui_component/sample_module_card_edit.xml +++ b/test/Expectations/Crud/81/v1/view/adminhtml/ui_component/sample_module_card_edit.xml @@ -92,6 +92,7 @@ true category_id + true true @@ -131,6 +132,9 @@ true store_id + + true + diff --git a/test/Expectations/Crud/81/v1/view/adminhtml/ui_component/sample_module_card_listing.xml b/test/Expectations/Crud/81/v1/view/adminhtml/ui_component/sample_module_card_listing.xml index 2da925c..ac4e3e8 100644 --- a/test/Expectations/Crud/81/v1/view/adminhtml/ui_component/sample_module_card_listing.xml +++ b/test/Expectations/Crud/81/v1/view/adminhtml/ui_component/sample_module_card_listing.xml @@ -139,6 +139,7 @@ text + true true diff --git a/test/Expectations/Crud/81/v1/view/adminhtml/ui_component/sample_module_cartitem_edit.xml b/test/Expectations/Crud/81/v1/view/adminhtml/ui_component/sample_module_cartitem_edit.xml index ec07ef1..9277edd 100644 --- a/test/Expectations/Crud/81/v1/view/adminhtml/ui_component/sample_module_cartitem_edit.xml +++ b/test/Expectations/Crud/81/v1/view/adminhtml/ui_component/sample_module_cartitem_edit.xml @@ -119,6 +119,7 @@ true customer_group + true true diff --git a/test/Expectations/Crud/81/v1/view/adminhtml/ui_component/sample_module_cartitem_listing.xml b/test/Expectations/Crud/81/v1/view/adminhtml/ui_component/sample_module_cartitem_listing.xml index fc18439..d67c190 100644 --- a/test/Expectations/Crud/81/v1/view/adminhtml/ui_component/sample_module_cartitem_listing.xml +++ b/test/Expectations/Crud/81/v1/view/adminhtml/ui_component/sample_module_cartitem_listing.xml @@ -153,6 +153,7 @@ select + true true diff --git a/test/Expectations/Crud/81/v1/view/adminhtml/ui_component/sample_module_poster_listing.xml b/test/Expectations/Crud/81/v1/view/adminhtml/ui_component/sample_module_poster_listing.xml index 72ee234..37c8a22 100644 --- a/test/Expectations/Crud/81/v1/view/adminhtml/ui_component/sample_module_poster_listing.xml +++ b/test/Expectations/Crud/81/v1/view/adminhtml/ui_component/sample_module_poster_listing.xml @@ -104,6 +104,10 @@ text text + + true + true + diff --git a/test/Expectations/Crud/82/v1/Controller/Adminhtml/Card/Edit.php b/test/Expectations/Crud/82/v1/Controller/Adminhtml/Card/Edit.php index 6cac1d4..4c09471 100644 --- a/test/Expectations/Crud/82/v1/Controller/Adminhtml/Card/Edit.php +++ b/test/Expectations/Crud/82/v1/Controller/Adminhtml/Card/Edit.php @@ -54,7 +54,7 @@ public function execute(): ResultInterface ); $resultPage->getConfig()->getTitle()->prepend(__('Card')->render()); $resultPage->getConfig()->getTitle()->prepend( - $entity->getId() ? $entity->getTitle() : __('New Card')->render() + $entityId ? $entity->getTitle() : __('New Card')->render() ); return $resultPage; diff --git a/test/Expectations/Crud/82/v1/Controller/Adminhtml/CartItem/Edit.php b/test/Expectations/Crud/82/v1/Controller/Adminhtml/CartItem/Edit.php index b178abf..adb8544 100644 --- a/test/Expectations/Crud/82/v1/Controller/Adminhtml/CartItem/Edit.php +++ b/test/Expectations/Crud/82/v1/Controller/Adminhtml/CartItem/Edit.php @@ -54,7 +54,7 @@ public function execute(): ResultInterface ); $resultPage->getConfig()->getTitle()->prepend(__('Cart Item')->render()); $resultPage->getConfig()->getTitle()->prepend( - $entity->getId() ? $entity->getTitle() : __('New Cart Item')->render() + $entityId ? $entity->getTitle() : __('New Cart Item')->render() ); return $resultPage; diff --git a/test/Expectations/Crud/82/v1/Controller/Adminhtml/Columns/Edit.php b/test/Expectations/Crud/82/v1/Controller/Adminhtml/Columns/Edit.php index d87ad2a..a6806d0 100644 --- a/test/Expectations/Crud/82/v1/Controller/Adminhtml/Columns/Edit.php +++ b/test/Expectations/Crud/82/v1/Controller/Adminhtml/Columns/Edit.php @@ -54,7 +54,7 @@ public function execute(): ResultInterface ); $resultPage->getConfig()->getTitle()->prepend(__('Columns')->render()); $resultPage->getConfig()->getTitle()->prepend( - $entity->getId() ? $entity->getTitle() : __('New Columns')->render() + $entityId ? $entity->getTitle() : __('New Columns')->render() ); return $resultPage; diff --git a/test/Expectations/Crud/82/v1/Controller/Adminhtml/Obsolete/Edit.php b/test/Expectations/Crud/82/v1/Controller/Adminhtml/Obsolete/Edit.php index e374942..ab45862 100644 --- a/test/Expectations/Crud/82/v1/Controller/Adminhtml/Obsolete/Edit.php +++ b/test/Expectations/Crud/82/v1/Controller/Adminhtml/Obsolete/Edit.php @@ -65,7 +65,7 @@ public function execute() ); $resultPage->getConfig()->getTitle()->prepend(__('Obsolete')->render()); $resultPage->getConfig()->getTitle()->prepend( - $entity->getId() ? $entity->getTitle() : __('New Obsolete')->render() + $entityId ? $entity->getTitle() : __('New Obsolete')->render() ); return $resultPage;