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

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