22. Feb 2022 |

Magento REST API – Specified request cannot be processed and Class does not exist

Class \Vendor\ModuleName\Api\TestInterface does not exist

During development move things from local-src + symlink to app/code/{vendor}/{modulename} so that namespace and folder structure could match.

If you are using interfaces in your module then this is also true that you need to use full path reference in PHPdoc instead of use import and reference.

Both worked for me

Specified request cannot be processed

rest/V1/test/ – V in version needs to be capital letter (also in webapi.xml).

And just useful tip that you can extract interface out of existing class.

10. Feb 2022 |

Create a Magento plugin

Name plugin classes after what they do rather than after their target class.

First create plugin class and then configure it in di.xml. Plugin “name” in di.xml is module name that it is located at.

Plugin classes are located in Plugin folder within respective module.

After plugins execute after the target method. As a second argument after methods take return value of the target method.

10. Feb 2022 |

Create an empty Magento 2 module to vendor

Add repository section to Magento composer.json file with the following command. Path refers to the location of your module’s repository (or just local folder).

composer config repositories.robert-empty path ./local-src/robert-empty/

Then create composer.json, registration.php and etc/module.xml for the module. Manually, just copy from another module and update the content.

Then tell composer to install our module by referring to the package name defined in composer.json “name” field. This creates symlink with module repository to vendor folder.

composer require robert/module-empty

Then enable module. this command adds the module to app/etc/config.php file. List of modules to load and their load order. In database moduls are registered to setup_module table.

php bin/magento module:enable Robert_Empty && php bin/magento setup:upgrade

You can skip the first part of the command because setup:upgrade automatically enables new modules.

registration.php – makes the module visible.

etc/module.xml – lists depencencies in sequence node that have to be loaded first.

13. Jun 2018 |

Kust saab Magentot alla laadida?

Magento kodulehelt on seda esimene kord üsna keeruline leida aga õige koht on siin. Ning jah, erinevalt WordPressist tuleb Magento allalaadimiseks ennast eelnevalt Magento kasutajaks registreerida. Sama kasutajaga saab õnneks ka Magento foorumites edaspidi osaleda.

Kuna iga allalaadimise korra jaoks genereeritakse unikaalne URL, siis ei saa seda ka wget’iga endale otse serverisse tõmmata (vähemalt mina ei oska).

Kuna see pakk, sisaldab umbes 60 tuhat(!) faili, siis ĂĽleslaadimise soovitan teha nii:

  1. Pane see sama tar.gz fail endale läbi FTP serverisse
  2. Unzip tee serveris (terminali käsuga).

Nii see läheb oluliselt kiiremini. Zone FTP kaudu sai seda vist unzipida (kui terminali ei oska kasutada) aga ma ise teen seda läbi SSH (Windowsis nt Powershell ja Ubuntus lihtsalt mistahes terminal).

Lahtipakkimisel ole ettevaatlik, et valesse kohta ei paki. Kinnitan, et teiste asjade vahelt nende ära kustutamine on pigem tüütu.