1
0
mirror of https://github.com/flarum/core.git synced 2025-10-18 10:16:09 +02:00

Added post extender with type method, deprecated ConfigurePostTypes (#2101)

This commit is contained in:
Alexander Skvortsov
2020-11-03 10:43:49 -05:00
committed by GitHub
parent 5842dd1200
commit cee87848fe
6 changed files with 106 additions and 5 deletions

View File

@@ -218,7 +218,7 @@ class Post extends AbstractModel
* @param string $model The class name of the model for that type.
* @return void
*/
public static function setModel($type, $model)
public static function setModel(string $type, string $model)
{
static::$models[$type] = $model;
}

View File

@@ -21,19 +21,20 @@ class PostServiceProvider extends AbstractServiceProvider
{
CommentPost::setFormatter($this->app->make('flarum.formatter'));
$this->registerPostTypes();
$this->setPostTypes();
$events = $this->app->make('events');
$events->subscribe(PostPolicy::class);
}
public function registerPostTypes()
protected function setPostTypes()
{
$models = [
CommentPost::class,
DiscussionRenamedPost::class
];
// Deprecated in beta 15, remove in beta 16.
$this->app->make('events')->dispatch(
new ConfigurePostTypes($models)
);