File tree Expand file tree Collapse file tree
wcfsetup/install/files/lib Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -129,12 +129,13 @@ public function readData()
129129 // get label object type handlers
130130 $ objectTypes = ObjectTypeCache::getInstance ()->getObjectTypes ('com.woltlab.wcf.label.objectType ' );
131131 foreach ($ objectTypes as $ objectType ) {
132- $ this ->labelObjectTypes [$ objectType ->objectTypeID ] = $ objectType ->getProcessor ();
133- $ this ->labelObjectTypes [$ objectType ->objectTypeID ]->setObjectTypeID ($ objectType ->objectTypeID );
134- }
132+ $ handler = $ objectType ->getProcessor ();
133+ \assert ($ handler instanceof ILabelObjectTypeHandler);
134+
135+ $ container = $ handler ->getContainerForObjectType ($ objectType );
135136
136- foreach ( $ this ->labelObjectTypes as $ objectTypeID => $ labelObjectType ) {
137- $ this ->labelObjectTypeContainers [$ objectTypeID ] = $ labelObjectType -> getContainer () ;
137+ $ this ->labelObjectTypes [ $ objectType -> objectTypeID ] = $ handler ;
138+ $ this ->labelObjectTypeContainers [$ objectType -> objectTypeID ] = $ container ;
138139 }
139140
140141 parent ::readData ();
Original file line number Diff line number Diff line change 22
33namespace wcf \system \label \object \type ;
44
5+ use wcf \data \object \type \ObjectType ;
56use wcf \system \SingletonFactory ;
67
78/**
@@ -16,36 +17,41 @@ abstract class AbstractLabelObjectTypeHandler extends SingletonFactory implement
1617 /**
1718 * label object type container
1819 * @var LabelObjectTypeContainer
20+ * @deprecated 6.2 Use `getContainerForObjectType()` instead.
1921 */
2022 public $ container ;
2123
2224 /**
2325 * object type id
2426 * @var int
27+ * @deprecated 6.2 Use `getContainerForObjectType()` instead.
2528 */
2629 public $ objectTypeID = 0 ;
2730
28- /**
29- * @inheritDoc
30- */
31+ #[\Override]
3132 public function setObjectTypeID ($ objectTypeID )
3233 {
3334 $ this ->objectTypeID = $ objectTypeID ;
3435 }
3536
36- /**
37- * @inheritDoc
38- */
37+ #[\Override]
3938 public function getObjectTypeID ()
4039 {
4140 return $ this ->objectTypeID ;
4241 }
4342
44- /**
45- * @inheritDoc
46- */
43+ #[\Override]
4744 public function getContainer ()
4845 {
4946 return $ this ->container ;
5047 }
48+
49+ #[\Override]
50+ public function getContainerForObjectType (ObjectType $ objectType ): LabelObjectTypeContainer
51+ {
52+ // This exists for backwards-compatibility only; Implementations are
53+ // expected to implement this method themselves.
54+ $ this ->setObjectTypeID ($ objectType ->objectTypeID );
55+ return $ this ->getContainer ();
56+ }
5157}
Original file line number Diff line number Diff line change 22
33namespace wcf \system \label \object \type ;
44
5+ use wcf \data \object \type \ObjectType ;
6+
57/**
68 * Every label object type handler has to implement this interface.
79 *
1113 */
1214interface ILabelObjectTypeHandler
1315{
16+ /**
17+ * Provides a container object that groups all objects that can be assigned
18+ * a label group.
19+ *
20+ * Implementations must not rely on any state provided by `getObjectTypeID()`.
21+ *
22+ * @since 6.2
23+ */
24+ public function getContainerForObjectType (ObjectType $ objectType ): LabelObjectTypeContainer ;
25+
1426 /**
1527 * Sets object type id.
1628 *
1729 * @param int $objectTypeID
1830 * @return void
31+ * @deprecated 6.2 Use `getContainerForObjectType()` instead.
1932 */
2033 public function setObjectTypeID ($ objectTypeID );
2134
2235 /**
2336 * Returns object type id.
2437 *
2538 * @return int
39+ * @deprecated 6.2 Use `getContainerForObjectType()` instead.
2640 */
2741 public function getObjectTypeID ();
2842
2943 /**
3044 * Returns a label object type container.
3145 *
3246 * @return LabelObjectTypeContainer
47+ * @deprecated 6.2 Use `getContainerForObjectType()` instead.
3348 */
3449 public function getContainer ();
3550
You can’t perform that action at this time.
0 commit comments