Code Duplication    Length = 22-24 lines in 2 locations

src/Model/Table/ConversationsMessagesTable.php 1 location

@@ 16-37 (lines=22) @@
13
     * @param array $config The configuration for the Table.
14
     * @return void
15
     */
16
    public function initialize(array $config)
17
    {
18
        $this->table('conversations_messages');
19
        $this->displayField('id');
20
        $this->primaryKey('id');
21
22
        $this->addBehavior('Timestamp');
23
        $this->addBehavior('CounterCache', [
24
            'Conversations' => ['reply_count']
25
        ]);
26
27
        $this->belongsTo('Conversations', [
28
            'foreignKey' => 'conversation_id'
29
        ]);
30
        $this->belongsTo('Users', [
31
            'foreignKey' => 'user_id'
32
        ]);
33
        $this->belongsTo('LastEditUsers', [
34
            'className' => 'Users',
35
            'foreignKey' => 'last_edit_user_id'
36
        ]);
37
    }
38
39
    /**
40
     * Default validation rules.

src/Model/Table/PollsUsersTable.php 1 location

@@ 23-46 (lines=24) @@
20
     *
21
     * @return void
22
     */
23
    public function initialize(array $config)
24
    {
25
        parent::initialize($config);
26
27
        $this->table('polls_users');
28
        $this->displayField('id');
29
        $this->primaryKey('id');
30
31
        $this->addBehavior('Timestamp');
32
        $this->addBehavior('CounterCache', [
33
            'Polls' => ['user_count'],
34
            'PollsAnswers' => ['user_count']
35
        ]);
36
37
        $this->belongsTo('Polls', [
38
            'foreignKey' => 'poll_id'
39
        ]);
40
        $this->belongsTo('Users', [
41
            'foreignKey' => 'user_id'
42
        ]);
43
        $this->belongsTo('PollsAnswers', [
44
            'foreignKey' => 'answer_id'
45
        ]);
46
    }
47
}
48