Skip to content

Commit e9f2141

Browse files
committed
OXDEV-8635: Adjust a few things from template split
1 parent 361e26d commit e9f2141

6 files changed

Lines changed: 35 additions & 36 deletions

File tree

README.md

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ Story:
4242
- User custom greetings are saved via shop model save method. We subscribe to BeforeModelUpdate to track how often a user changed his personal greeting.
4343
- Tracking of this information will be done in a new database table to serve as an example for module's own shop model.
4444
- Module will extend the shop's basket model to add info to module specific log file when an item is added into basket. Logging can be enabled or disabled depending on module setting.
45-
- Module will have console command `oetemplate:logger:read` to read log file.
45+
- Module will have console command `oeexamples:logger:read` to read log file.
4646

4747
```bash
48-
./vendor/bin/oe-console oetemplate:logger:read
48+
./vendor/bin/oe-console oeexamples:logger:read
4949
```
5050

5151
## Goals
@@ -56,43 +56,43 @@ Install and try out the module with simple examples to most common development q
5656

5757
The repository contains examples of following cases and more:
5858

59-
* [Extending of shop controllers and models](https://github.com/OXID-eSales/module-template/blob/b-7.2.x/metadata.php#L25)
60-
* extending a shop model (`OxidEsales\ModuleTemplate\Extension\Model\User`) / (`OxidEsales\ModuleTemplate\Extension\Model\Basket`)
61-
* extending a shop controller (`OxidEsales\ModuleTemplate\Extension\Controller\StartController`)
59+
* [Extending of shop controllers and models](https://github.com/OXID-eSales/examples-module/blob/b-7.3.x/metadata.php#L25)
60+
* extending a shop model (`OxidEsales\ExamplesModule\Extension\Model\User`) / (`OxidEsales\ExamplesModule\Extension\Model\Basket`)
61+
* extending a shop controller (`OxidEsales\ExamplesModule\Extension\Controller\StartController`)
6262

63-
* [New controllers](https://github.com/OXID-eSales/module-template/blob/b-7.2.x/metadata.php#L30)
63+
* [New controllers](https://github.com/OXID-eSales/examples-module/blob/b-7.3.x/metadata.php#L30)
6464
* own module controller (`oeemgreeting` with own template and own translations)
6565
* own module admin controller (`oeem_admin_greeting` with own template and own translations)
6666

67-
* [Using Symfony DI](https://github.com/OXID-eSales/module-template/blob/b-7.2.x/services.yaml)
68-
* [Injection of Registry classes with bind](https://github.com/OXID-eSales/module-template/blob/b-7.2.x/src/Greeting/services.yaml#L5)
67+
* [Using Symfony DI](https://github.com/OXID-eSales/examples-module/blob/b-7.3.x/services.yaml)
68+
* [Injection of Registry classes with bind](https://github.com/OXID-eSales/examples-module/blob/b-7.3.x/src/Greeting/services.yaml#L5)
6969

70-
* [Migrations](https://github.com/OXID-eSales/module-template/tree/b-7.2.x/migration)
70+
* [Migrations](https://github.com/OXID-eSales/examples-module/tree/b-7.3.x/migration)
7171
* extending a shop database table (`oxuser`)
7272

7373
* Accessing the database
74-
* model with a database (`OxidEsales\ModuleTemplate\Tracker\Model\GreetingTracker`)
75-
* ``oxNew`` object factory example (`OxidEsales\ModuleTemplate\Greeting\Infrastructure\UserModelFactory`)
74+
* model with a database (`OxidEsales\ExamplesModule\Tracker\Model\GreetingTracker`)
75+
* ``oxNew`` object factory example (`OxidEsales\ExamplesModule\Greeting\Infrastructure\UserModelFactory`)
7676
* [DAO](src/ProductVote/Dao)
7777

78-
* [Various types of module settings](https://github.com/OXID-eSales/module-template/blob/b-7.2.x/metadata.php#L38)
78+
* [Various types of module settings](https://github.com/OXID-eSales/examples-module/blob/b-7.3.x/metadata.php#L38)
7979

8080
* Templates
81-
* [creating templates for your module](https://github.com/OXID-eSales/module-template/blob/b-7.2.x/views/twig/templates/greetingtemplate.html.twig)
82-
* [extending of oxid theme templates or blocks](https://github.com/OXID-eSales/module-template/tree/b-7.2.x/views/twig/extensions/themes)
81+
* [creating templates for your module](https://github.com/OXID-eSales/examples-module/blob/b-7.3.x/views/twig/templates/greetingtemplate.html.twig)
82+
* [extending of oxid theme templates or blocks](https://github.com/OXID-eSales/examples-module/tree/b-7.3.x/views/twig/extensions/themes)
8383
* extending a shop admin template block (`admin_user_main_form` - only an extension of a block, without functionality)
8484
* extending a shop template block (`start_newest_articles`)
8585

8686
* Using the translations for your module specific phrases
87-
* [in admin](https://github.com/OXID-eSales/module-template/tree/b-7.2.x/views/admin_twig)
88-
* [in frontend](https://github.com/OXID-eSales/module-template/tree/b-7.2.x/translations)
87+
* [in admin](https://github.com/OXID-eSales/examples-module/tree/b-7.3.x/views/admin_twig)
88+
* [in frontend](https://github.com/OXID-eSales/examples-module/tree/b-7.3.x/translations)
8989

9090
* Events and listeners
91-
* [Subscribing to shop events](https://github.com/OXID-eSales/module-template/blob/b-7.2.x/src/Tracker/Subscriber/BeforeModelUpdate.php)
91+
* [Subscribing to shop events](https://github.com/OXID-eSales/examples-module/blob/b-7.3.x/src/Tracker/Subscriber/BeforeModelUpdate.php)
9292

9393
* Testing your module backend and frontend part
94-
* [Composer aliases for easy running of tests and quality tools](https://github.com/OXID-eSales/module-template/blob/b-7.2.x/composer.json#L48)
95-
* [Using the github actions as CI tool with all recommended tools preconfigured for you.](https://github.com/OXID-eSales/module-template/tree/b-7.2.x/.github)
94+
* [Composer aliases for easy running of tests and quality tools](https://github.com/OXID-eSales/examples-module/blob/b-7.3.x/composer.json#L48)
95+
* [Using the github actions as CI tool with all recommended tools preconfigured for you.](https://github.com/OXID-eSales/examples-module/tree/b-7.3.x/.github)
9696

9797
**HINTS**:
9898
* Only extend the shop core if there is no other way like listen and handle shop events,
@@ -120,8 +120,8 @@ installation/usage methods.
120120

121121
This module is in working state and can be directly installed via composer:
122122
```
123-
composer require oxid-esales/module-template
124-
./vendor/bin/oe-eshop-doctrine_migration migrations:migrate oe_moduletemplate
123+
composer require oxid-esales/examples-module
124+
./vendor/bin/oe-eshop-doctrine_migration migrations:migrate oe_examples_module
125125
```
126126

127127
and [activate the module](https://docs.oxid-esales.com/developer/en/latest/development/modules_components_themes/module/installation_setup/setup.html#setup-activation).
@@ -161,7 +161,7 @@ You should be able to access the shop with http://localhost.local and the admin
161161

162162
## Things to be aware of
163163

164-
The module template is intended to act as a tutorial module so keep your eyes open for comments in the code.
164+
The examples module is intended to act as a tutorial module so keep your eyes open for comments in the code.
165165

166166
**NOTES:**
167167
* Acceptance tests are way easier to write if you put an id on relevant fields and buttons in the templates.
@@ -175,13 +175,13 @@ The module template is intended to act as a tutorial module so keep your eyes op
175175
Migrations have to be run via console command (`./vendor/bin/oe-eshop-doctrine_migration`)
176176

177177
```bash
178-
./vendor/bin/oe-eshop-doctrine_migration migrations:migrate oe_moduletemplate
178+
./vendor/bin/oe-eshop-doctrine_migration migrations:migrate oe_examples_module
179179
```
180180

181181
NOTE: Existing migrations must not be changed. If the database needs a change, add a new migration file and change to your needs:
182182

183183
```bash
184-
./vendor/bin/oe-eshop-doctrine_migration migrations:generate oe_moduletemplate
184+
./vendor/bin/oe-eshop-doctrine_migration migrations:generate oe_examples_module
185185
```
186186

187187
For more information, check the [developer documentation](https://docs.oxid-esales.com/developer/en/latest/development/tell_me_about/migrations.html).
@@ -223,7 +223,6 @@ $ composer phpmd
223223
- run `composer update` in module root directory
224224

225225
```bash
226-
$ cd vendor/oxid-esales/module-template
227226
$ composer update
228227
```
229228

@@ -272,8 +271,8 @@ output in failure case, so you literally get a picture of the fail (`tests/Corec
272271

273272
### Github Actions Workflow
274273

275-
The module template comes complete with a github actions workflow. No need to rig up some separate continuous integration
276-
infrastructure to run tests, it's all there in [github](https://github.com/OXID-eSales/module-template/actions).
274+
The examples-module comes complete with a github actions workflow. No need to rig up some separate continuous integration
275+
infrastructure to run tests, it's all there in [github](https://github.com/OXID-eSales/examples-module/actions).
277276
You will see three files in `.github/workflow` directory. The workflow from
278277
`.github/workflow/trigger.yaml` starts on every `push` and `pull_request` to run the code quality checks and all the module tests.
279278

src/Greeting/Controller/Admin/GreetingAdminController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
use OxidEsales\ExamplesModule\Core\Module as ModuleCore;
1313
use OxidEsales\Eshop\Application\Controller\Admin\AdminController;
14-
use OxidEsales\ExamplesModule\Extension\Model\User as TemplateModelUser;
14+
use OxidEsales\ExamplesModule\Extension\Model\User as ExamplesModelUser;
1515
use OxidEsales\ExamplesModule\Greeting\Service\UserServiceInterface;
1616

1717
class GreetingAdminController extends AdminController
@@ -22,7 +22,7 @@ public function render()
2222
{
2323
$userService = $this->getService(UserServiceInterface::class);
2424
if ($this->getEditObjectId()) {
25-
/** @var TemplateModelUser $oUser */
25+
/** @var ExamplesModelUser $oUser */
2626
$oUser = $userService->getUserById($this->getEditObjectId());
2727
$this->addTplParam(ModuleCore::OEEM_ADMIN_GREETING_TEMPLATE_VARNAME, $oUser->getPersonalGreeting());
2828
}

src/Greeting/Controller/GreetingController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use OxidEsales\Eshop\Application\Controller\FrontendController;
1313
use OxidEsales\Eshop\Application\Model\User as EshopModelUser;
1414
use OxidEsales\ExamplesModule\Core\Module as ModuleCore;
15-
use OxidEsales\ExamplesModule\Extension\Model\User as TemplateModelUser;
15+
use OxidEsales\ExamplesModule\Extension\Model\User as ExamplesModelUser;
1616
use OxidEsales\ExamplesModule\Greeting\Service\GreetingMessageServiceInterface;
1717
use OxidEsales\ExamplesModule\Settings\Service\ModuleSettingsServiceInterface;
1818
use OxidEsales\ExamplesModule\Tracker\Repository\TrackerRepositoryInterface;
@@ -44,7 +44,7 @@ public function render()
4444
$moduleSettings = $this->getService(ModuleSettingsServiceInterface::class);
4545
$repository = $this->getService(TrackerRepositoryInterface::class);
4646

47-
/** @var TemplateModelUser $user */
47+
/** @var ExamplesModelUser $user */
4848
$user = $this->getUser();
4949

5050
/** @phpstan-ignore-next-line */

src/Greeting/Service/GreetingMessageService.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use OxidEsales\Eshop\Core\Language as EshopLanguage;
1414
use OxidEsales\Eshop\Core\Request as EshopRequest;
1515
use OxidEsales\ExamplesModule\Core\Module as ModuleCore;
16-
use OxidEsales\ExamplesModule\Extension\Model\User as TemplateModelUser;
16+
use OxidEsales\ExamplesModule\Extension\Model\User as ExamplesModelUser;
1717
use OxidEsales\ExamplesModule\Settings\Service\ModuleSettingsServiceInterface;
1818

1919
readonly class GreetingMessageService implements GreetingMessageServiceInterface
@@ -51,7 +51,7 @@ private function translate(string $toTranslate): string
5151
*/
5252
public function saveGreeting(EshopModelUser $user): bool
5353
{
54-
/** @var TemplateModelUser $user */
54+
/** @var ExamplesModelUser $user */
5555
$user->setPersonalGreeting($this->getRequestOeemGreeting());
5656

5757
return (bool)$user->save();
@@ -74,7 +74,7 @@ private function getRequestOeemGreeting(): string
7474
private function getUserGreeting(?EshopModelUser $user = null): string
7575
{
7676
if (is_object($user)) {
77-
/** @var TemplateModelUser $user */
77+
/** @var ExamplesModelUser $user */
7878
$result = $user->getPersonalGreeting();
7979
}
8080

src/Logging/Command/ReadLogsCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
class ReadLogsCommand extends Command
1717
{
18-
private const COMMAND_NAME = 'oetemplate:logger:read';
18+
private const COMMAND_NAME = 'oeexamples:logger:read';
1919
private const COMMAND_DESCRIPTION = 'Log file reader.';
2020
private const COMMAND_HELP = 'Reads log file and outputs content.';
2121
private const LOG_FILE_CONTENT = 'Log file content:';

src/Logging/services.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ services:
88
arguments:
99
$logFilePath: '%app.log_file_path%'
1010
tags:
11-
- { name: 'console.command', command: 'oetemplate:logger:read' }
11+
- { name: 'console.command', command: 'oeexamples:logger:read' }
1212

1313
OxidEsales\ExamplesModule\Logging\Service\BasketProductLoggerServiceInterface:
1414
class: OxidEsales\ExamplesModule\Logging\Service\BasketProductLoggerService

0 commit comments

Comments
 (0)