magento2-model-generator icon indicating copy to clipboard operation
magento2-model-generator copied to clipboard

Improvements Compilation

Open theshreyas opened this issue 10 months ago • 0 comments

1. Cannot Allow Fulltext Search on integer columns

SQLSTATE[HY000]: General error: 1283 Column 'entity_id' cannot be part of FULLTEXT index, query was: CREATE TABLE `vendorname_test_blog` (
`entity_id` int UNSIGNED NOT NULL  AUTO_INCREMENT COMMENT "entity_id", 
CONSTRAINT  PRIMARY KEY (`entity_id`), 
FULLTEXT INDEX `VENDORNAME_TEST_BLOG_ENTITY_ID` (`entity_id`)
) ENGINE=innodb DEFAULT CHARSET=utf8mb3 DEFAULT COLLATE=utf8mb3_general_ci COMMENT="BLOGs"

StepsToReproduce : select any integer field as model column, enable admingrid and search checkbox. Solution : Disable search checkbox when integer field is present in model column and vice versa

2. Declaration of Magento\Framework\Api\SearchResults::getItems() must be compatible with Vendorname\CustomModule\Api\Data\BlogSearchResultsInterface::getItems(): array in /var/www/html/m3/vendor/magento/framework/Api/SearchResults.php on line 26

StepsToReproduce : select model with 3-4 field/columns. Solution : Remove strict return type from Api/Data/ModelSearchResultsInterface.php file (array & static) old public function getItems(): array; public function setItems(array $items): static; new public function getItems(); public function setItems(array $items);

3. Class "Vendorname\CustomModule\Controller\Adminhtml\Blog\ModelFactory" does not exist. Class Vendorname\CustomModule\Controller\Adminhtml\Blog\Delete\Interceptor generation error: The requested class did not generate properly,

StepsToReproduce : select model with 3-4 field/columns. Solution : In the file Vendorname/Module/Controller/Adminhtml/Modelname/Delete.php, on line 8, change this line from use Vendorname\Module\Model\ModelnameFactory; to use Vendorname\Module\Model\ModelnameFactory as ModelFactory;

4. In backend, admin grid is not present. Add routes.xml, menu.xml 5. run phpcs & phpcbf on generated module and incorporate changes, e.g. adding php docblocks, etc.

I will add more to this as I remember. and Awesome module!

theshreyas avatar Apr 02 '24 20:04 theshreyas