CommentThreadCreatorTrait
Creates a comment thread ({@see CommentThread}) for an entity and links it through an FK column.
Use it in an Api manager whose entity has a thread (article, gallery...): call
createCommentThread() in afterSave on insert so comments can be added to the object right away.
Tags
Table of Contents
Methods
- createCommentThread() : Result|null
- Creates a new {@see CommentThread} and writes its id into `$column` of the entity with id `$entityId` (default `commentThreadId`, a scalar FK; pass the association name for an association). Returns a failed {@see Result} (the caller in `afterSave` may return it, which rolls back), or null when there is nothing to do or everything is fine.
Methods
createCommentThread()
Creates a new {@see CommentThread} and writes its id into `$column` of the entity with id `$entityId` (default `commentThreadId`, a scalar FK; pass the association name for an association). Returns a failed {@see Result} (the caller in `afterSave` may return it, which rolls back), or null when there is nothing to do or everything is fine.
protected
createCommentThread(int|null $entityId, ThreadType $type[, string $column = 'commentThreadId' ]) : Result|null
Parameters
- $entityId : int|null
- $type : ThreadType
- $column : string = 'commentThreadId'