mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
ENH Add generic types (#739)
This commit is contained in:
parent
e8e40a808d
commit
3b8092272b
@ -533,7 +533,7 @@ class Blog extends Page implements PermissionProvider
|
|||||||
* @param null|int $month
|
* @param null|int $month
|
||||||
* @param null|int $day
|
* @param null|int $day
|
||||||
*
|
*
|
||||||
* @return DataList
|
* @return DataList<BlogPost>
|
||||||
*/
|
*/
|
||||||
public function getArchivedBlogPosts($year, $month = null, $day = null)
|
public function getArchivedBlogPosts($year, $month = null, $day = null)
|
||||||
{
|
{
|
||||||
@ -574,7 +574,7 @@ class Blog extends Page implements PermissionProvider
|
|||||||
/**
|
/**
|
||||||
* Return blog posts.
|
* Return blog posts.
|
||||||
*
|
*
|
||||||
* @return DataList of BlogPost objects
|
* @return DataList<BlogPost> of BlogPost objects
|
||||||
*/
|
*/
|
||||||
public function getBlogPosts()
|
public function getBlogPosts()
|
||||||
{
|
{
|
||||||
|
@ -2,10 +2,13 @@
|
|||||||
|
|
||||||
namespace SilverStripe\Blog\Model;
|
namespace SilverStripe\Blog\Model;
|
||||||
|
|
||||||
|
use SilverStripe\Comments\Model\Comment;
|
||||||
use SilverStripe\ORM\DataExtension;
|
use SilverStripe\ORM\DataExtension;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds Blog specific behaviour to Comment.
|
* Adds Blog specific behaviour to Comment.
|
||||||
|
*
|
||||||
|
* @extends DataExtension<Comment>
|
||||||
*/
|
*/
|
||||||
class BlogCommentExtension extends DataExtension
|
class BlogCommentExtension extends DataExtension
|
||||||
{
|
{
|
||||||
|
@ -15,7 +15,11 @@ use SilverStripe\Blog\Model\BlogTag;
|
|||||||
use SilverStripe\Blog\Model\BlogCategory;
|
use SilverStripe\Blog\Model\BlogCategory;
|
||||||
use SilverStripe\View\Parsers\URLSegmentFilter;
|
use SilverStripe\View\Parsers\URLSegmentFilter;
|
||||||
use SilverStripe\Control\HTTPRequest;
|
use SilverStripe\Control\HTTPRequest;
|
||||||
|
use SilverStripe\ORM\SS_List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @extends PageController<Blog>
|
||||||
|
*/
|
||||||
class BlogController extends PageController
|
class BlogController extends PageController
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -58,7 +62,7 @@ class BlogController extends PageController
|
|||||||
/**
|
/**
|
||||||
* The current Blog Post DataList query.
|
* The current Blog Post DataList query.
|
||||||
*
|
*
|
||||||
* @var DataList
|
* @var DataList<BlogPost>
|
||||||
*/
|
*/
|
||||||
protected $blogPosts;
|
protected $blogPosts;
|
||||||
|
|
||||||
@ -67,9 +71,6 @@ class BlogController extends PageController
|
|||||||
*/
|
*/
|
||||||
public function index(HTTPRequest $request)
|
public function index(HTTPRequest $request)
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @var Blog $dataRecord
|
|
||||||
*/
|
|
||||||
$dataRecord = $this->dataRecord;
|
$dataRecord = $this->dataRecord;
|
||||||
|
|
||||||
$this->blogPosts = $dataRecord->getBlogPosts();
|
$this->blogPosts = $dataRecord->getBlogPosts();
|
||||||
@ -128,7 +129,7 @@ class BlogController extends PageController
|
|||||||
/**
|
/**
|
||||||
* Get posts related to the current Member profile.
|
* Get posts related to the current Member profile.
|
||||||
*
|
*
|
||||||
* @return null|DataList
|
* @return null|DataList<BlogPost>
|
||||||
*/
|
*/
|
||||||
public function getCurrentProfilePosts()
|
public function getCurrentProfilePosts()
|
||||||
{
|
{
|
||||||
@ -443,7 +444,7 @@ class BlogController extends PageController
|
|||||||
/**
|
/**
|
||||||
* Returns a list of paginated blog posts based on the BlogPost dataList.
|
* Returns a list of paginated blog posts based on the BlogPost dataList.
|
||||||
*
|
*
|
||||||
* @return PaginatedList
|
* @return PaginatedList<SS_List, BlogPost>
|
||||||
*/
|
*/
|
||||||
public function PaginatedList()
|
public function PaginatedList()
|
||||||
{
|
{
|
||||||
|
@ -16,7 +16,6 @@ use SilverStripe\Versioned\Versioned;
|
|||||||
/**
|
/**
|
||||||
* This class is responsible for filtering the SiteTree when necessary and also overlaps into
|
* This class is responsible for filtering the SiteTree when necessary and also overlaps into
|
||||||
* filtering only published posts.
|
* filtering only published posts.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
class BlogFilter extends Lumberjack
|
class BlogFilter extends Lumberjack
|
||||||
{
|
{
|
||||||
|
@ -19,6 +19,8 @@ use SilverStripe\View\Requirements;
|
|||||||
*
|
*
|
||||||
* @method SilverStripe\ORM\ManyManyList<BlogPost> BlogPosts()
|
* @method SilverStripe\ORM\ManyManyList<BlogPost> BlogPosts()
|
||||||
* @method Image BlogProfileImage()
|
* @method Image BlogProfileImage()
|
||||||
|
*
|
||||||
|
* @extends DataExtension<Member>
|
||||||
*/
|
*/
|
||||||
class BlogMemberExtension extends DataExtension
|
class BlogMemberExtension extends DataExtension
|
||||||
{
|
{
|
||||||
|
@ -21,7 +21,7 @@ trait BlogObject
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param int|array|null $id Optional ID(s) for parent of this relation, if not the current record
|
* @param int|array|null $id Optional ID(s) for parent of this relation, if not the current record
|
||||||
* @return DataList
|
* @return DataList<BlogPost>
|
||||||
*/
|
*/
|
||||||
public function BlogPosts($id = null)
|
public function BlogPosts($id = null)
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,9 @@ namespace SilverStripe\Blog\Model;
|
|||||||
|
|
||||||
use PageController;
|
use PageController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @extends PageController<BlogPost>
|
||||||
|
*/
|
||||||
class BlogPostController extends PageController
|
class BlogPostController extends PageController
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -8,6 +8,8 @@ use SilverStripe\Forms\CheckboxField;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a checkbox field for featured blog posts widget.
|
* Adds a checkbox field for featured blog posts widget.
|
||||||
|
*
|
||||||
|
* @extends DataExtension<BlogPost>
|
||||||
*/
|
*/
|
||||||
class BlogPostFeaturedExtension extends DataExtension
|
class BlogPostFeaturedExtension extends DataExtension
|
||||||
{
|
{
|
||||||
|
@ -17,6 +17,7 @@ use SilverStripe\Versioned\Versioned;
|
|||||||
* This is responsible for filtering only published posts to users who do not have permission to
|
* This is responsible for filtering only published posts to users who do not have permission to
|
||||||
* view non-published posts.
|
* view non-published posts.
|
||||||
*
|
*
|
||||||
|
* @extends DataExtension<BlogPost>
|
||||||
*/
|
*/
|
||||||
class BlogPostFilter extends DataExtension
|
class BlogPostFilter extends DataExtension
|
||||||
{
|
{
|
||||||
|
@ -12,6 +12,8 @@ use SilverStripe\Security\Member;
|
|||||||
* Customise blog post to support comment notifications.
|
* Customise blog post to support comment notifications.
|
||||||
*
|
*
|
||||||
* Extends {@see BlogPost} with extensions to {@see CommentNotifiable}.
|
* Extends {@see BlogPost} with extensions to {@see CommentNotifiable}.
|
||||||
|
*
|
||||||
|
* @extends DataExtension<BlogPost>
|
||||||
*/
|
*/
|
||||||
class BlogPostNotifications extends DataExtension
|
class BlogPostNotifications extends DataExtension
|
||||||
{
|
{
|
||||||
|
@ -108,7 +108,7 @@ class BlogArchiveWidget extends Widget
|
|||||||
/**
|
/**
|
||||||
* Returns a list of months where blog posts are present.
|
* Returns a list of months where blog posts are present.
|
||||||
*
|
*
|
||||||
* @return ArrayList
|
* @return ArrayList<ArrayData>
|
||||||
*/
|
*/
|
||||||
public function getArchive()
|
public function getArchive()
|
||||||
{
|
{
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace SilverStripe\Blog\Widgets;
|
namespace SilverStripe\Blog\Widgets;
|
||||||
|
|
||||||
use SilverStripe\Blog\Model\Blog;
|
use SilverStripe\Blog\Model\Blog;
|
||||||
|
use SilverStripe\Blog\Model\BlogCategory;
|
||||||
use SilverStripe\Core\Convert;
|
use SilverStripe\Core\Convert;
|
||||||
use SilverStripe\Forms\DropdownField;
|
use SilverStripe\Forms\DropdownField;
|
||||||
use SilverStripe\Forms\FieldList;
|
use SilverStripe\Forms\FieldList;
|
||||||
@ -106,7 +107,7 @@ class BlogCategoriesWidget extends Widget
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return DataList
|
* @return DataList<BlogCategory>
|
||||||
*/
|
*/
|
||||||
public function getCategories()
|
public function getCategories()
|
||||||
{
|
{
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace SilverStripe\Blog\Widgets;
|
namespace SilverStripe\Blog\Widgets;
|
||||||
|
|
||||||
use SilverStripe\Blog\Model\Blog;
|
use SilverStripe\Blog\Model\Blog;
|
||||||
|
use SilverStripe\Blog\Model\BlogTag;
|
||||||
use SilverStripe\Core\Convert;
|
use SilverStripe\Core\Convert;
|
||||||
use SilverStripe\Forms\DropdownField;
|
use SilverStripe\Forms\DropdownField;
|
||||||
use SilverStripe\Forms\FieldList;
|
use SilverStripe\Forms\FieldList;
|
||||||
@ -106,7 +107,7 @@ class BlogTagsWidget extends Widget
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return DataList
|
* @return DataList<BlogTag>
|
||||||
*/
|
*/
|
||||||
public function getTags()
|
public function getTags()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user