16 private const ITEM_TYPE =
'SECTION';
17 private const USER_TYPE =
'USER';
21 $key = self::ITEM_TYPE .
'_' . $itemId;
22 if (!array_key_exists($key, static::$cache))
25 $section = (
new Section())->getById($itemId);
27 $sectionModel = SectionModel::createFromId($itemId);
30 $owner = $section->getOwner();
31 $ownerId = $owner ? $owner->getId() : 0;
33 ->setType($section->getType())
34 ->setOwnerId($ownerId)
38 static::$cache[$key] = $sectionModel;
41 return static::$cache[$key];
46 $key = self::USER_TYPE .
'_' . $userId;
47 if (!array_key_exists($key, static::$cache))
49 static::$cache[$key] = UserModel::createFromId($userId);
52 return static::$cache[$key];
loadItem(int $itemId=null)