Code Duplication    Length = 57-57 lines in 2 locations

src/Model/BlogCategory.php 1 location

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

src/Model/BlogTag.php 1 location

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