Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Entity factory.

Copyright: 2019 Ryan Wyllie <ryan@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 258 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: entity  - X-Ref

Entity factory to create the forum entities.

See:
https://designpatternsphp.readthedocs.io/en/latest/Creational/SimpleFactory/README.html

get_forum_from_stdclass(stdClass $record,context $context,stdClass $coursemodule,stdClass $course)   X-Ref
Create a forum entity from a stdClass (legacy forum object).

param: stdClass $record The forum record
param: context $context The forum module context
param: stdClass $coursemodule Course module record for the forum
param: stdClass $course Course the forum belongs to
return: forum_entity

get_discussion_from_stdclass(stdClass $record)   X-Ref
Create a discussion entity from an stdClass (legacy dicussion object).

param: stdClass $record Discussion record
return: discussion_entity

get_post_from_stdclass(stdClass $record)   X-Ref
Create a post entity from an stdClass (legacy post object).

param: stdClass $record The post record
return: post_entity

get_author_from_stdclass(stdClass $record)   X-Ref
Create an author entity from a user record.

param: stdClass $record The user record
return: author_entity

get_discussion_summary_from_stdclass(stdClass $discussion,stdClass $firstpost,stdClass $firstpostauthor,stdClass $latestpostauthor)   X-Ref
Create a discussion summary enttiy from stdClasses.

param: stdClass $discussion The discussion record
param: stdClass $firstpost A post record for the first post in the discussion
param: stdClass $firstpostauthor A user record for the author of the first post
param: stdClass $latestpostauthor A user record for the author of the latest post in the discussion
return: discussion_summary_entity

get_post_read_receipt_collection_from_stdclasses(array $records)   X-Ref
Create a post read receipt collection entity from a list of read receipt records.

param: array $records A list of read receipt records.
return: post_read_receipt_collection_entity

get_posts_sorter()   X-Ref
Create a sorter entity to sort post entities.

return: sorter_entity

get_exported_posts_sorter()   X-Ref
No description