Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f33d2aa

Browse files
committed
Fix whitespace and formatting in documentation
This commit standardizes whitespace, removes trailing spaces, and improves formatting across multiple documentation files for consistency and readability. No content changes were made.
1 parent 24f9c5d commit f33d2aa

File tree

16 files changed

+117
-120
lines changed

16 files changed

+117
-120
lines changed

development/coding-standards/_index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class MyClass
8686
{
8787
public function doStuff(string $foo, array $bar): void
8888
{
89-
}
89+
}
9090
}
9191
```
9292

@@ -149,7 +149,7 @@ You can run the linter to help you comply with these coding standards:
149149
150150
## TypeScript
151151
152-
All `admin-dev/themes/new-theme/js` files are coded in TypeScript. Classes and functions in .ts files must be strictly typed.
152+
All `admin-dev/themes/new-theme/js` files are coded in TypeScript. Classes and functions in .ts files must be strictly typed.
153153

154154
You are able to get global types in the `admin-dev/themes/new-theme/js/types` folder using the `@PSTypes` relative path and some types library are imported from npm using the `@types` namespace and automatically imported by TypeScript.
155155

development/compile-assets.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Some components in PrestaShop, like Javascript or SCSS files, need to be compile
1111

1212
We use [Webpack](https://webpack.js.org/) to compile assets. PrestaShop is using NodeJS ([get it here](https://nodejs.org/)), NPM will take care of it all.
1313

14-
Here is a list of compatibility:
14+
Here is a list of compatibility:
1515

1616
| PrestaShop Versions | NodeJS Versions | NPM Versions |
1717
|---------------------|-----------------|--------------|

development/components/console/context-helper.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ MyCustomCommand extends ContainerAwareCommand
2828
protected function execute(InputInterface $input, OutputInterface $output)
2929
{
3030
$this->getContainer()->get('prestashop.adapter.legacy_context_loader')->loadGenericContext();
31-
31+
3232
...
3333
}
3434
});

development/components/console/prestashop-linter-security-attribute.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,4 @@ Two options are available: Listing and Finding Missing.
2020
This option aims to list all routes, and their related permissions.
2121

2222
### Finding missing
23-
This option aims to find routes with missing security attributes.
24-
23+
This option aims to find routes with missing security attributes.

development/components/console/prestashop-list-commands-and-queries.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,3 @@ title: prestashop:list:commands-and-queries
1313
This command aims to list all available CQRS commands and queries.
1414

1515
That permits to list all classes, with their types (Command or Query) and their description.
16-

development/components/database/dbquery.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,61 +21,61 @@ return Db::getInstance()->executeS($sql);
2121
{{% funcdef %}}
2222

2323
__toString()
24-
:
24+
:
2525
Generate and get the query.
2626

2727
build()
28-
:
28+
:
2929
Generate and get the query (return a string).
3030

3131
from(string $table, mixed $alias = null)
32-
:
32+
:
3333
Set table for FROM clause.
3434

3535
groupBy(string $fields)
36-
:
36+
:
3737
Add a GROUP BY restriction.
3838

3939
having(string $restriction)
40-
:
40+
:
4141
Add a restriction in the HAVING clause (each restriction will be separated by an AND statement).
4242

4343
innerJoin(string $table, string $alias = null, string $on = null)
44-
:
44+
:
4545
Add a INNER JOIN clause<br>
4646
E.g. `$this->innerJoin('product p ON ...')`.
4747

4848
join(string $join)
49-
:
49+
:
5050
Add a JOIN clause<br>
5151
E.g. `$this->join('RIGHT JOIN'.DB_PREFIX.'produc t p ON ...');`.
5252

5353
leftJoin(string $table, string $alias = null, string $on = null)
54-
:
54+
:
5555
Add a LEFT JOIN clause.
5656

5757
leftOuterJoin(string $table, string $alias = null, string $on = null)
58-
:
58+
:
5959
Add a LEFT OUTER JOIN clause.
6060

6161
limit(int $limit, int $offset = 0)
62-
:
62+
:
6363
Limit results in query.
6464

6565
naturalJoin(string $table, string $alias = null)
66-
:
66+
:
6767
Add a NATURAL JOIN clause.
6868

6969
orderBy(string $fields)
70-
:
70+
:
7171
Add an ORDER BY restriction.
7272

7373
select(string $fields)
74-
:
74+
:
7575
Add fields in query selection.
7676

7777
where(string $restriction)
78-
:
78+
:
7979
Add a restriction in WHERE clause (each restriction will be separated by an AND statement).
8080

8181
{{% /funcdef %}}

development/components/database/objectmodel.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ Read more about Object relation mapping (ORM), Database abstraction layer (DBAL)
1818
- [Data access layer (DAL)](https://en.wikipedia.org/wiki/Data_access_layer)
1919
- [Active record pattern](https://en.wikipedia.org/wiki/Active_record_pattern)
2020

21-
A class extending the ObjectModel class is tied to a database table. Its static attribute (`$definition`) represents the model.
21+
A class extending the ObjectModel class is tied to a database table. Its static attribute (`$definition`) represents the model.
2222

23-
Its instances are tied to database records.
23+
Its instances are tied to database records.
2424

25-
When instantiated with an `$id` in the class constructor, the attributes are retrieved from the related database record (using the `$id` as the primary key to find the table record).
25+
When instantiated with an `$id` in the class constructor, the attributes are retrieved from the related database record (using the `$id` as the primary key to find the table record).
2626

2727
{{% notice info %}}
28-
You can override classes that extend ObjectModel, but with extreme precaution, e.g., defining a wrong `$definition` model can break the entire system or lead to data loss.
28+
You can override classes that extend ObjectModel, but with extreme precaution, e.g., defining a wrong `$definition` model can break the entire system or lead to data loss.
2929
{{% /notice %}}
3030

3131
## Create a new entity managed by ObjectModel
3232

33-
You can create a new entity (in a module for example), with its own database table, managed by ObjectModel.
33+
You can create a new entity (in a module for example), with its own database table, managed by ObjectModel.
3434

3535
To do this, create class extending the ObjectModel:
3636

@@ -122,14 +122,14 @@ public static $definition = [
122122
'fields' => array(
123123
```
124124

125-
- `table` is the related database table name (without the database table `PREFIX`),
125+
- `table` is the related database table name (without the database table `PREFIX`),
126126
- `primary` is the name of the `PRIMARY KEY` field in the database table, which will be used as `$id` in the ObjectModel
127127
- `multilang` is a boolean value indicating that the entity is available in multiple langages, see [Multiple languages]({{< ref "#multiple-languages" >}})
128128
- `fields` is an array containing all other of the fields from the database table.
129129

130130
### Fields description
131131

132-
A field is defined by a key (its name in the database table) and an array of its settings.
132+
A field is defined by a key (its name in the database table) and an array of its settings.
133133

134134
```php
135135
'meta_description' => [
@@ -165,13 +165,13 @@ Field type is an important setting, it determines how ObjectModel will format yo
165165

166166
#### Validation rules reference
167167

168-
Several validation rules are available for your ObjectModel fields.
168+
Several validation rules are available for your ObjectModel fields.
169169
[Please refer to the Validate class of PrestaShop](https://github.com/PrestaShop/PrestaShop/blob/8.0.x/classes/Validate.php) for a complete list.
170170

171171
### Add timestamps to your entity (date_add and date_upd)
172172

173-
ObjectModel has a mechanism to handle creation/modification timestamps.
174-
To use this feature, you have to define those two properties of your entity and set them up in the model definition.
173+
ObjectModel has a mechanism to handle creation/modification timestamps.
174+
To use this feature, you have to define those two properties of your entity and set them up in the model definition.
175175

176176
```php
177177
class Cms extends ObjectModel
@@ -215,7 +215,7 @@ If the insert is successful, the ObjectModel class will set the entity's id (ret
215215

216216
```php
217217
$id = 2; // id of the object in database
218-
$cms = new Cms($id);
218+
$cms = new Cms($id);
219219
$cms->position = 3;
220220
...
221221
$cms->save();
@@ -225,7 +225,7 @@ In this example, we retrieve an entity from the database with its id. Then, we c
225225

226226
### Hard or soft delete an object
227227

228-
Two delete mechanisms are available with ObjectModel: hard delete and soft delete.
228+
Two delete mechanisms are available with ObjectModel: hard delete and soft delete.
229229
Hard-delete deletes the record from the database, while soft-delete sets a flag in the table's field indicating that this record is deleted.
230230

231231
{{% notice info %}}
@@ -242,13 +242,13 @@ Soft deleting an object does not trigger **Delete** related hooks, but will trig
242242

243243
```php
244244
$id = 2; // id of the object in database
245-
$cms = new Cms($id);
245+
$cms = new Cms($id);
246246
$cms->softDelete(); // sets the deleted property to true, and triggers an update() call
247247
...
248248
$cms->delete(); // triggers a DELETE statement to the DBAL
249249
```
250250

251-
## Advanced usage
251+
## Advanced usage
252252

253253
### Multiple languages objects{#multiple-languages}
254254

@@ -257,7 +257,7 @@ PrestaShop's ObjectModel can handle translations (also called internationalizati
257257
#### Under the hood: how does it work?
258258

259259
When declaring a multi-language ObjectModel, PrestaShop will fetch another database table named like your base database table, but with a suffix `_lang`
260-
This table references the id of the base Object (`id_cms`), the id of the language (`id_lang`), and each translatable field.
260+
This table references the id of the base Object (`id_cms`), the id of the language (`id_lang`), and each translatable field.
261261

262262
In our previous example, for `Cms` ObjectModel:
263263

@@ -308,7 +308,7 @@ And then, you must declare which fields are available for translations:
308308

309309
#### Accessors for translatable ObjectModels{#multiple-language-accessors}
310310

311-
Translatable fields are available in your ObjectModel as `array`.
311+
Translatable fields are available in your ObjectModel as `array`.
312312
In our example, to update the attributes `meta_title` for languages EN (`$lang_id=1`) and FR (`$lang_id=2`), use the following method :
313313

314314
```php
@@ -333,7 +333,7 @@ PrestaShop's ObjectModel can handle multiple stores (or multi shop) ObjectModels
333333
#### Under the hood: how does it work?
334334

335335
When declaring a multi-store ObjectModel, PrestaShop will fetch another database table named like your base database table, with a suffix `_shop`
336-
This table is a pivot table referencing at least the id of the base Object (`id_cms`) and the id of the shop (`id_shop`).
336+
This table is a pivot table referencing at least the id of the base Object (`id_cms`) and the id of the shop (`id_shop`).
337337

338338
In our previous example, for `Cms` ObjectModel:
339339

@@ -382,7 +382,7 @@ PrestaShop's ObjectModel can handle both multiple languages and multiple shop en
382382
#### Under the hood: how does it work?
383383

384384
When declaring a multi-store ObjectModel, PrestaShop will fetch another database table named like your base database table, with a suffix `_shop`
385-
This table is a pivot table referencing at least the id of the base Object (`id_cms`) and the id of the shop (`id_shop`).
385+
This table is a pivot table referencing at least the id of the base Object (`id_cms`) and the id of the shop (`id_shop`).
386386

387387
In our previous example, for `Category` ObjectModel :
388388

@@ -458,7 +458,7 @@ $category->save();
458458
To duplicate an object, use the following method : `duplicateObject()`
459459

460460
```php
461-
$cms = new Cms(2);
461+
$cms = new Cms(2);
462462
$duplicatedCms = $cms->duplicateObject();
463463
```
464464

@@ -470,14 +470,14 @@ Please note that the `duplicateObject()` method will instantly save the duplicat
470470

471471
### Partial update of an object
472472

473-
Since {{< minver v="8.x" >}}, a partial update mechanism is available in ObjectModel. This mechanism allows you to choose which attributes you want to update during the `update()` method call.
473+
Since {{< minver v="8.x" >}}, a partial update mechanism is available in ObjectModel. This mechanism allows you to choose which attributes you want to update during the `update()` method call.
474474

475475
On previous versions ({{< minver v="1.7.x" >}}, {{< minver v="1.6.x" >}}, ...), this method was already available but was not working properly.
476476

477477
Example:
478478

479479
```php
480-
$cms = new Cms(2);
480+
$cms = new Cms(2);
481481
$cms->position = 4;
482482
$cms->active = 0;
483483
$cms->setFieldsToUpdate(["position" => true]);
@@ -491,7 +491,7 @@ In this example, only the `position` is updated, `active` (and all other fields)
491491
You need to specify the language Ids you want to update, as an array :
492492

493493
```php
494-
$cms = new Cms(2);
494+
$cms = new Cms(2);
495495
$cms->meta_title[1] = "My awesome title"; // language id #1
496496
$cms->meta_title[2] = "Mon fabuleux titre"; // language id #2
497497
$cms->setFieldsToUpdate(
@@ -507,8 +507,8 @@ $cms->save(); // only meta_title for language id #1 will be updated
507507

508508
### Toggle status
509509

510-
A mecanism of state is available with ObjectModel : active / inactive state.
511-
When triggered, this mecanism allows your entities to be enabled / disabled.
510+
A mecanism of state is available with ObjectModel : active / inactive state.
511+
When triggered, this mecanism allows your entities to be enabled / disabled.
512512

513513
{{% notice info %}}
514514
**Status is not always available.**
@@ -518,15 +518,15 @@ If the model object has no `active` property or no `active` definition field, a
518518

519519
```php
520520
$id = 2; // id of the entity in database
521-
$cms = new Cms($id);
521+
$cms = new Cms($id);
522522
$cms->toggleStatus(); // sets the active property to true or false (depending on its current value), and triggers an update() call
523523
```
524524

525525
### Delete multiple entities
526526

527-
You can delete multiple object at once with the `deleteSelection` method. Pass an array of IDs to delete to this method, and they will be deleted.
527+
You can delete multiple object at once with the `deleteSelection` method. Pass an array of IDs to delete to this method, and they will be deleted.
528528

529-
Usage :
529+
Usage :
530530

531531
```php
532532
$cmsIdsToDelete = [1, 2, 3, 8, 10];
@@ -564,7 +564,7 @@ public function hookActionObjectProductDeleteAfter(Product $product)
564564
{
565565
PrestaShopLogger::addLog(
566566
sprintf('Product with id %s was deleted with success', $product->id_product)
567-
);
567+
);
568568
}
569569
```
570570

0 commit comments

Comments
 (0)