| @@ 23-79 (lines=57) @@ | ||
| 20 | * @property string $URLSegment |
|
| 21 | * @property int $BlogID |
|
| 22 | */ |
|
| 23 | class BlogCategory extends DataObject implements CategorisationObject |
|
| 24 | { |
|
| 25 | use BlogObject; |
|
| 26 | ||
| 27 | /** |
|
| 28 | * Use an exception code so that attempted writes can continue on |
|
| 29 | * duplicate errors. |
|
| 30 | * |
|
| 31 | * @const string |
|
| 32 | * This must be a string because ValidationException has decided we can't use int |
|
| 33 | */ |
|
| 34 | const DUPLICATE_EXCEPTION = 'DUPLICATE'; |
|
| 35 | ||
| 36 | /** |
|
| 37 | * {@inheritDoc} |
|
| 38 | * @var string |
|
| 39 | */ |
|
| 40 | private static $table_name = 'BlogCategory'; |
|
| 41 | ||
| 42 | /** |
|
| 43 | * @var array |
|
| 44 | */ |
|
| 45 | private static $db = array( |
|
| 46 | 'Title' => 'Varchar(255)', |
|
| 47 | 'URLSegment' => 'Varchar(255)' |
|
| 48 | ); |
|
| 49 | ||
| 50 | /** |
|
| 51 | * @var array |
|
| 52 | */ |
|
| 53 | private static $has_one = array( |
|
| 54 | 'Blog' => Blog::class, |
|
| 55 | ); |
|
| 56 | ||
| 57 | /** |
|
| 58 | * @var array |
|
| 59 | */ |
|
| 60 | private static $belongs_many_many = array( |
|
| 61 | 'BlogPosts' => BlogPost::class, |
|
| 62 | ); |
|
| 63 | ||
| 64 | /** |
|
| 65 | * {@inheritdoc} |
|
| 66 | */ |
|
| 67 | protected function getListUrlSegment() |
|
| 68 | { |
|
| 69 | return 'category'; |
|
| 70 | } |
|
| 71 | ||
| 72 | /** |
|
| 73 | * {@inheritdoc} |
|
| 74 | */ |
|
| 75 | protected function getDuplicateError() |
|
| 76 | { |
|
| 77 | return _t('BlogCategory.Duplicate', 'A blog category already exists with that name.'); |
|
| 78 | } |
|
| 79 | } |
|
| 80 | ||
| @@ 23-79 (lines=57) @@ | ||
| 20 | * @property string $URLSegment |
|
| 21 | * @property int $BlogID |
|
| 22 | */ |
|
| 23 | class BlogTag extends DataObject implements CategorisationObject |
|
| 24 | { |
|
| 25 | use BlogObject; |
|
| 26 | ||
| 27 | /** |
|
| 28 | * Use an exception code so that attempted writes can continue on |
|
| 29 | * duplicate errors. |
|
| 30 | * |
|
| 31 | * @const string |
|
| 32 | * This must be a string because ValidationException has decided we can't use int |
|
| 33 | */ |
|
| 34 | const DUPLICATE_EXCEPTION = 'DUPLICATE'; |
|
| 35 | ||
| 36 | /** |
|
| 37 | * {@inheritDoc} |
|
| 38 | * @var string |
|
| 39 | */ |
|
| 40 | private static $table_name = 'BlogTag'; |
|
| 41 | ||
| 42 | /** |
|
| 43 | * @var array |
|
| 44 | */ |
|
| 45 | private static $db = array( |
|
| 46 | 'Title' => 'Varchar(255)', |
|
| 47 | 'URLSegment' => 'Varchar(255)' |
|
| 48 | ); |
|
| 49 | ||
| 50 | /** |
|
| 51 | * @var array |
|
| 52 | */ |
|
| 53 | private static $has_one = array( |
|
| 54 | 'Blog' => Blog::class |
|
| 55 | ); |
|
| 56 | ||
| 57 | /** |
|
| 58 | * @var array |
|
| 59 | */ |
|
| 60 | private static $belongs_many_many = array( |
|
| 61 | 'BlogPosts' => BlogPost::class |
|
| 62 | ); |
|
| 63 | ||
| 64 | /** |
|
| 65 | * {@inheritdoc} |
|
| 66 | */ |
|
| 67 | protected function getListUrlSegment() |
|
| 68 | { |
|
| 69 | return 'tag'; |
|
| 70 | } |
|
| 71 | ||
| 72 | /** |
|
| 73 | * {@inheritdoc} |
|
| 74 | */ |
|
| 75 | protected function getDuplicateError() |
|
| 76 | { |
|
| 77 | return _t('BlogTag.Duplicate', 'A blog tag already exists with that name.'); |
|
| 78 | } |
|
| 79 | } |
|
| 80 | ||