Skip to content

Commit 304d5d9

Browse files
committed
Generate a class reference for models
1 parent a3aa85f commit 304d5d9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+2158
-1
lines changed

build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if vendor/bin/daux generate --source=. --destination=html ; then
1919
fi
2020

2121
# Generate a zip file containing the complete static site, placing it inside the html folder again
22-
zip -r html/modmore-documentation.zip html
22+
#zip -r html/modmore-documentation.zip html
2323
else
2424
echo "Failed generating documentation";
2525
exit 1;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Returns a localised `yes` or `no` value depending on the boolean input. The translation comes from the MODX lexicon for `yes` and `no`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
The `date` formatter takes in a unix timestamp (e.g. `1584964242`) and returns a date stamp without the time.
2+
3+
The `server_offset_time` setting is taken into account. You can use this if your server time is different from the current time.
4+
5+
The format used is set in the `commerce.date_format` system setting, uses [strftime](https://php.net/strftime), and defaults to `%Y-%m-%d`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
The `datetime` formatter takes in a unix timestamp (e.g. `1584964242`) and returns a full date/timestamp. Frequently used for timestamps.
2+
3+
The `server_offset_time` setting is taken into account. You can use this if your server time is different from the current time.
4+
5+
The format used is set in the `commerce.datetime_format` system setting, uses [strftime](https://php.net/strftime), and defaults to `%Y-%m-%d at %H:%M:%S %Z`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
With the `filesize` formatter, an integer number of bytes is formatted into the most appropriate readable size.
2+
3+
For example a value of 2355 would be formatted as `2.31 KB` while `3.932.160` is `3.75MB`.
4+
5+
The decimal point is used from the currently active currency.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
The `financial` formatter takes in an integer number (e.g. `1850`) and turns it into a currency-formatted value (e.g. `€18,50`).
2+
3+
The currency that is used is typically based on the `currency` field on the same model. If that's not specified, the currency is taken from the current active currency based on the context or system configuration.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Formatters are generalised functions that take in a raw value, and output a formatted value in a way that people would expect the value to be rendered.
2+
3+
They are called automatically for many fields in the model, available as `<field>_formatted` in templates and code.
4+
5+
To call a formatter from a model (taking into account the currency specified in the currency field, if it exists), use:
6+
7+
```php
8+
return $this->formatValue($value, 'name-of-formatter');
9+
```
10+
11+
From external code, such as snippets, you can also call the `formatValue` method on the `Commerce` service class.
12+
13+
```php
14+
return $commerce->formatValue($value, 'name-of-formatter');
15+
```
16+
17+
For financial formatting where you have the relevant currency object, you can also use `$currency->format($amountInCents)`.
18+
19+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
The `percentage` formatter takes in a floating decimal number (up to 10 decimals) and returns a number formatted value with only the number of decimals necessary, and a `%` suffix.
2+
3+
For example, inputting `15.2450000` returns `15.245%` and `99` returns `99%`.
4+
5+
The decimal point and thousands separator are taken from the currently active currency based on context or system configuration.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
The `time` formatter takes in a unix timestamp (e.g. `1584964242`) and returns a timestamp, without a date.
2+
3+
The `server_offset_time` setting is taken into account. You can use this if your server time is different from the current time.
4+
5+
The format used is set in the `commerce.time_format` system setting, uses [strftime](https://php.net/strftime), and defaults to `%H:%M:%S %Z`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
## Meta
2+
3+
- Extends: [`comSimpleObject`](comSimpleObject)
4+
- Table: `modx_commerce_address`
5+
6+
## Relations
7+
8+
- `User`: one `modUser` object (`comAddress.user = modUser.id`)
9+
10+
## Fields
11+
12+
13+
| Field | Type | Description |
14+
| ----- | ---- | ----------- |
15+
| **id** | integer (`INTEGER`) | Primary key |
16+
| **class_key** | string (`varchar[100]`) | Type of object |
17+
| **properties** | array (`text`)<br>may be null | Serialized arbitrary data stored with an object. Use utility methods instead of directly accessing these values: `getProperty($key, $default)`, `getProperties()`, `setProperty($key, $value)`, `setProperties($properties, $merge)`, `unsetProperty($key)`, `unsetProperties($keys)` |
18+
| **user** | int (`int[10]`)<br>may be null | |
19+
| **type<br>Default: `billing`** | string (`varchar[190]`) | |
20+
| **fullname** | string (`varchar[190]`)<br>may be null | |
21+
| **firstname** | string (`varchar[190]`)<br>may be null | |
22+
| **lastname** | string (`varchar[190]`)<br>may be null | |
23+
| **company** | string (`varchar[190]`)<br>may be null | |
24+
| **address1** | string (`varchar[190]`)<br>may be null | |
25+
| **address2** | string (`varchar[190]`)<br>may be null | |
26+
| **address3** | string (`varchar[190]`)<br>may be null | |
27+
| **zip** | string (`varchar[190]`)<br>may be null | |
28+
| **city** | string (`varchar[190]`)<br>may be null | |
29+
| **state** | string (`varchar[190]`)<br>may be null | |
30+
| **country** | string (`varchar[190]`)<br>may be null | |
31+
| **phone** | string (`varchar[190]`)<br>may be null | |
32+
| **mobile** | string (`varchar[190]`)<br>may be null | |
33+
| **email** | string (`varchar[190]`)<br>may be null | |
34+
| **notes** | string (`text`)<br>may be null | |
35+
| **remember** | bool (`tinyint[1]`)<br>may be null | Deprecated; no longer relevant. |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
Special type of [Order](comOrder) that represents a cancelled state.
2+
3+
## Meta
4+
5+
- Extends: [`comOrder`](comOrder)
6+
- Table: `modx_commerce_order`
7+
8+
## Relations
9+
10+
- `Context`: one `modContext` object (`comCancelledOrder.context = modContext.key`)
11+
- `Status`: one [`comStatus`](comStatus) object (`comCancelledOrder.status = comStatus.id`)
12+
- `CreatedBy`: one `modUser` object (`comCancelledOrder.created_by = modUser.id`)
13+
- `LastUpdatedBy`: one `modUser` object (`comCancelledOrder.last_updated_by = modUser.id`)
14+
- `StatusUpdatedBy`: one `modUser` object (`comCancelledOrder.status_updated_by = modUser.id`)
15+
- `ShippingMethod`: one [`comShippingMethod`](comShippingMethod) object (`comCancelledOrder.shipping_method = comShippingMethod.id`)
16+
- `Parent`: one [`comOrder`](comOrder) object (`comCancelledOrder.parent = comOrder.id`)
17+
- `User`: one `modUser` object (`comCancelledOrder.user = modUser.id`)
18+
- `Descendants`: many [`comOrder`](comOrder) objects (`comCancelledOrder.id = comOrder.parent`)
19+
- `Items`: many [`comOrderItem`](comOrderItem) objects (`comCancelledOrder.id = comOrderItem.order`)
20+
- `Addresses`: many [`comOrderAddress`](comOrderAddress) objects (`comCancelledOrder.id = comOrderAddress.order`)
21+
- `Transactions`: many [`comTransaction`](comTransaction) objects (`comCancelledOrder.id = comTransaction.order`)
22+
- `Logs`: many [`comOrderLog`](comOrderLog) objects (`comCancelledOrder.id = comOrderLog.order`)
23+
24+
## Fields
25+
26+
27+
| Field | Type | Description |
28+
| ----- | ---- | ----------- |
29+
| **id** | integer (`INTEGER`) | Primary key |
30+
| **class_key** | string (`varchar[100]`) | Type of object |
31+
| **properties** | array (`text`)<br>may be null | Serialized arbitrary data stored with an object. Use utility methods instead of directly accessing these values: `getProperty($key, $default)`, `getProperties()`, `setProperty($key, $value)`, `setProperties($properties, $merge)`, `unsetProperty($key)`, `unsetProperties($keys)` |
32+
| **secret** | string (`varchar[191]`) | |
33+
| **test** | boolean (`tinyint[1]`) | |
34+
| **status** | integer (`int[10]`) | |
35+
| **currency** | string (`varchar[3]`) | |
36+
| **context<br>Default: `web`** | string (`varchar[190]`)<br>may be null | |
37+
| **reference** | string (`varchar[190]`)<br>may be null | |
38+
| **reference_incr** | integer (`int[10]`)<br>may be null | |
39+
| **subtotal** | integer (`int[20]`) | Integer number in the currency base unit (e.g. cents) |
40+
| **subtotal_formatted** | | `subtotal` passed through the [financial formatter](../Formatters/financial) |
41+
| **discount** | integer (`int[20]`) | Integer number in the currency base unit (e.g. cents) |
42+
| **discount_formatted** | | `discount` passed through the [financial formatter](../Formatters/financial) |
43+
| **shipping** | integer (`int[20]`) | Integer number in the currency base unit (e.g. cents) |
44+
| **shipping_formatted** | | `shipping` passed through the [financial formatter](../Formatters/financial) |
45+
| **transaction** | integer (`int[20]`) | Integer number in the currency base unit (e.g. cents) |
46+
| **transaction_formatted** | | `transaction` passed through the [financial formatter](../Formatters/financial) |
47+
| **total_before_tax** | integer (`int[20]`) | Integer number in the currency base unit (e.g. cents) |
48+
| **total_before_tax_formatted** | | `total_before_tax` passed through the [financial formatter](../Formatters/financial) |
49+
| **total_ex_tax** | integer (`int[20]`) | Integer number in the currency base unit (e.g. cents) |
50+
| **total_ex_tax_formatted** | | `total_ex_tax` passed through the [financial formatter](../Formatters/financial) |
51+
| **tax** | integer (`int[20]`) | Integer number in the currency base unit (e.g. cents) |
52+
| **tax_formatted** | | `tax` passed through the [financial formatter](../Formatters/financial) |
53+
| **total** | integer (`int[20]`) | Integer number in the currency base unit (e.g. cents) |
54+
| **total_formatted** | | `total` passed through the [financial formatter](../Formatters/financial) |
55+
| **total_due** | integer (`int[20]`) | Integer number in the currency base unit (e.g. cents) |
56+
| **total_due_formatted** | | `total_due` passed through the [financial formatter](../Formatters/financial) |
57+
| **total_quantity** | integer (`int[20]`) | |
58+
| **created_on** | int (`int[20]`) | UNIX timestamp |
59+
| **created_on_formatted** | | `created_on` passed through the [datetime formatter](../Formatters/datetime) |
60+
| **received_on** | int (`int[20]`) | UNIX timestamp |
61+
| **received_on_formatted** | | `received_on` passed through the [datetime formatter](../Formatters/datetime) |
62+
| **last_updated_on** | int (`int[20]`) | UNIX timestamp |
63+
| **last_updated_on_formatted** | | `last_updated_on` passed through the [datetime formatter](../Formatters/datetime) |
64+
| **status_updated_on** | int (`int[20]`) | UNIX timestamp |
65+
| **status_updated_on_formatted** | | `status_updated_on` passed through the [datetime formatter](../Formatters/datetime) |
66+
| **created_by** | int (`int[10]`) | |
67+
| **last_updated_by** | int (`int[10]`) | |
68+
| **status_updated_by** | int (`int[10]`) | |
69+
| **shipping_method** | integer (`int[10]`) | |
70+
| **parent** | int (`int[10]`)<br>may be null | |
71+
| **user** | int (`int[10]`)<br>may be null | |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
Special type of [Order](comOrder) that represents the contents of a cart, before the order is marked as ready for processing.
2+
3+
## Meta
4+
5+
- Extends: [`comOrder`](comOrder)
6+
- Table: `modx_commerce_order`
7+
8+
## Descendant Classes
9+
10+
- [`comSessionCartOrder`](comSessionCartOrder)
11+
12+
13+
## Relations
14+
15+
- `Context`: one `modContext` object (`comCartOrder.context = modContext.key`)
16+
- `Status`: one [`comStatus`](comStatus) object (`comCartOrder.status = comStatus.id`)
17+
- `CreatedBy`: one `modUser` object (`comCartOrder.created_by = modUser.id`)
18+
- `LastUpdatedBy`: one `modUser` object (`comCartOrder.last_updated_by = modUser.id`)
19+
- `StatusUpdatedBy`: one `modUser` object (`comCartOrder.status_updated_by = modUser.id`)
20+
- `ShippingMethod`: one [`comShippingMethod`](comShippingMethod) object (`comCartOrder.shipping_method = comShippingMethod.id`)
21+
- `Parent`: one [`comOrder`](comOrder) object (`comCartOrder.parent = comOrder.id`)
22+
- `User`: one `modUser` object (`comCartOrder.user = modUser.id`)
23+
- `Descendants`: many [`comOrder`](comOrder) objects (`comCartOrder.id = comOrder.parent`)
24+
- `Items`: many [`comOrderItem`](comOrderItem) objects (`comCartOrder.id = comOrderItem.order`)
25+
- `Addresses`: many [`comOrderAddress`](comOrderAddress) objects (`comCartOrder.id = comOrderAddress.order`)
26+
- `Transactions`: many [`comTransaction`](comTransaction) objects (`comCartOrder.id = comTransaction.order`)
27+
- `Logs`: many [`comOrderLog`](comOrderLog) objects (`comCartOrder.id = comOrderLog.order`)
28+
29+
## Fields
30+
31+
32+
| Field | Type | Description |
33+
| ----- | ---- | ----------- |
34+
| **id** | integer (`INTEGER`) | Primary key |
35+
| **class_key** | string (`varchar[100]`) | Type of object |
36+
| **properties** | array (`text`)<br>may be null | Serialized arbitrary data stored with an object. Use utility methods instead of directly accessing these values: `getProperty($key, $default)`, `getProperties()`, `setProperty($key, $value)`, `setProperties($properties, $merge)`, `unsetProperty($key)`, `unsetProperties($keys)` |
37+
| **secret** | string (`varchar[191]`) | |
38+
| **test** | boolean (`tinyint[1]`) | |
39+
| **status** | integer (`int[10]`) | |
40+
| **currency** | string (`varchar[3]`) | |
41+
| **context<br>Default: `web`** | string (`varchar[190]`)<br>may be null | |
42+
| **reference** | string (`varchar[190]`)<br>may be null | |
43+
| **reference_incr** | integer (`int[10]`)<br>may be null | |
44+
| **subtotal** | integer (`int[20]`) | Integer number in the currency base unit (e.g. cents) |
45+
| **subtotal_formatted** | | `subtotal` passed through the [financial formatter](../Formatters/financial) |
46+
| **discount** | integer (`int[20]`) | Integer number in the currency base unit (e.g. cents) |
47+
| **discount_formatted** | | `discount` passed through the [financial formatter](../Formatters/financial) |
48+
| **shipping** | integer (`int[20]`) | Integer number in the currency base unit (e.g. cents) |
49+
| **shipping_formatted** | | `shipping` passed through the [financial formatter](../Formatters/financial) |
50+
| **transaction** | integer (`int[20]`) | Integer number in the currency base unit (e.g. cents) |
51+
| **transaction_formatted** | | `transaction` passed through the [financial formatter](../Formatters/financial) |
52+
| **total_before_tax** | integer (`int[20]`) | Integer number in the currency base unit (e.g. cents) |
53+
| **total_before_tax_formatted** | | `total_before_tax` passed through the [financial formatter](../Formatters/financial) |
54+
| **total_ex_tax** | integer (`int[20]`) | Integer number in the currency base unit (e.g. cents) |
55+
| **total_ex_tax_formatted** | | `total_ex_tax` passed through the [financial formatter](../Formatters/financial) |
56+
| **tax** | integer (`int[20]`) | Integer number in the currency base unit (e.g. cents) |
57+
| **tax_formatted** | | `tax` passed through the [financial formatter](../Formatters/financial) |
58+
| **total** | integer (`int[20]`) | Integer number in the currency base unit (e.g. cents) |
59+
| **total_formatted** | | `total` passed through the [financial formatter](../Formatters/financial) |
60+
| **total_due** | integer (`int[20]`) | Integer number in the currency base unit (e.g. cents) |
61+
| **total_due_formatted** | | `total_due` passed through the [financial formatter](../Formatters/financial) |
62+
| **total_quantity** | integer (`int[20]`) | |
63+
| **created_on** | int (`int[20]`) | UNIX timestamp |
64+
| **created_on_formatted** | | `created_on` passed through the [datetime formatter](../Formatters/datetime) |
65+
| **received_on** | int (`int[20]`) | UNIX timestamp |
66+
| **received_on_formatted** | | `received_on` passed through the [datetime formatter](../Formatters/datetime) |
67+
| **last_updated_on** | int (`int[20]`) | UNIX timestamp |
68+
| **last_updated_on_formatted** | | `last_updated_on` passed through the [datetime formatter](../Formatters/datetime) |
69+
| **status_updated_on** | int (`int[20]`) | UNIX timestamp |
70+
| **status_updated_on_formatted** | | `status_updated_on` passed through the [datetime formatter](../Formatters/datetime) |
71+
| **created_by** | int (`int[10]`) | |
72+
| **last_updated_by** | int (`int[10]`) | |
73+
| **status_updated_by** | int (`int[10]`) | |
74+
| **shipping_method** | integer (`int[10]`) | |
75+
| **parent** | int (`int[10]`)<br>may be null | |
76+
| **user** | int (`int[10]`)<br>may be null | |

0 commit comments

Comments
 (0)