You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The referenced class `FooUserNotificationObjectType` has to implement the [IUserNotificationObjectType](https://github.com/WoltLab/WCF/blob/master/wcfsetup/install/files/lib/system/user/notification/object/type/IUserNotificationObjectType.class.php) interface, which should be done by extending [AbstractUserNotificationObjectType](https://github.com/WoltLab/WCF/blob/master/wcfsetup/install/files/lib/system/user/notification/object/type/AbstractUserNotificationObjectType.class.php).
You have to set the class names of the database object (`$objectClassName`) and the related list (`$objectListClassName`).
25
25
Additionally, you have to create a class that implements the [IUserNotificationObject](https://github.com/WoltLab/WCF/blob/master/wcfsetup/install/files/lib/system/user/notification/object/IUserNotificationObject.class.php) whose name you have to set as the value of the `$decoratorClassName` property.
Here, you reference the user notification object type created via `objectType.xml`.
53
53
The referenced class in the `<classname>` element has to implement the [IUserNotificationEvent](https://github.com/WoltLab/WCF/blob/master/wcfsetup/install/files/lib/system/user/notification/event/IUserNotificationEvent.class.php) interface by extending the [AbstractUserNotificationEvent](https://github.com/WoltLab/WCF/blob/master/wcfsetup/install/files/lib/system/user/notification/event/AbstractUserNotificationEvent.class.php) class or the [AbstractSharedUserNotificationEvent](https://github.com/WoltLab/WCF/blob/master/wcfsetup/install/files/lib/system/user/notification/event/AbstractSharedUserNotificationEvent.class.php) class if you want to pre-load additional data before processing notifications.
54
54
In `AbstractSharedUserNotificationEvent::prepare()`, you can, for example, tell runtime caches to prepare to load certain objects which then are loaded all at once when the objects are needed.
Copy file name to clipboardExpand all lines: docs/php/code-style.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -146,9 +146,9 @@ $className = Example::class;
146
146
Some database objects provide static getters, either if they are decorators or for a unique combination of database table columns, like `wcf\data\box\Box::getBoxByIdentifier()`:
147
147
148
148
{jinja{ codebox(
149
-
"php",
150
-
"php/code-style/Box.class.php",
151
-
"files/lib/data/box/Box.class.php"
149
+
title="files/lib/data/box/Box.class.php",
150
+
language="php",
151
+
filepath="php/code-style/Box.class.php"
152
152
) }}
153
153
154
154
Such methods should always either return the desired object or `null` if the object does not exist.
Copy file name to clipboardExpand all lines: docs/php/database-objects.md
+18-18Lines changed: 18 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,9 +10,9 @@ Developers are required to provide the proper DatabaseObject implementations the
10
10
The basic model derives from `wcf\data\DatabaseObject` and provides a convenient constructor to fetch a single row or construct an instance using pre-loaded rows.
11
11
12
12
{jinja{ codebox(
13
-
"php",
14
-
"php/database-objects/Example.class.php",
15
-
"files/lib/data/example/Example.class.php"
13
+
title="files/lib/data/example/Example.class.php",
14
+
language="php",
15
+
filepath="php/database-objects/Example.class.php"
16
16
) }}
17
17
18
18
The class is intended to be empty by default and there only needs to be code if you want to add additional logic to your model. Both the class name and primary key are determined by `DatabaseObject` using the namespace and class name of the derived class. The example above uses the namespace `wcf\…` which is used as table prefix and the class name `Example` is converted into `exampleID`, resulting in the database table name `wcfN_example` with the primary key `exampleID`.
@@ -25,9 +25,9 @@ You can prevent this automatic guessing by setting the class properties `$databa
25
25
If you already have a `DatabaseObject` class and would like to extend it with additional data or methods, for example by providing a class `ViewableExample` which features view-related changes without polluting the original object, you can use `DatabaseObjectDecorator` which a default implementation of a decorator for database objects.
It is mandatory to set the static `$baseClass` property to the name of the decorated class.
@@ -43,9 +43,9 @@ You can access the decorated objects directly via `DatabaseObjectDecorator::getD
43
43
Adding, editing and deleting models is done using the `DatabaseObjectEditor` class that decorates a `DatabaseObject` and uses its data to perform the actions.
The editor class requires you to provide the fully qualified name of the model, that is the class name including the complete namespace. Database table name and index key will be pulled directly from the model.
@@ -103,9 +103,9 @@ $exampleEditor->delete();
103
103
Every row is represented as a single instance of the model, but the instance creation deals with single rows only. Retrieving larger sets of rows would be quite inefficient due to the large amount of queries that will be dispatched. This is solved with the `DatabaseObjectList` object that exposes an interface to query the database table using arbitrary conditions for data selection. All rows will be fetched using a single query and the resulting rows are automatically loaded into separate models.
@@ -179,9 +179,9 @@ Row creation and manipulation can be performed using the aforementioned `Databas
179
179
The `AbstractDatabaseObjectAction` solves both problems by wrapping around the editor class and thus provide an additional layer between the action that should be taken and the actual process. The first problem is solved by a fixed set of events being fired, the second issue is addressed by having a single entry point for all data editing.
0 commit comments