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