summaryrefslogtreecommitdiff
path: root/plugins/Group_assign/Model/NewMetaMagikSubquery.php
blob: 4870120e756a11f3bec2b137d549880f6ae4535d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php

namespace Kanboard\Plugin\Group_assign\Model;

use Kanboard\Plugin\Group_assign\Model\NewTaskFinderModel;

/**
 * New Task Finder model
 * Extends Group_assign Model
 *
 * @package  Kanboard\Plugin\Group_assign\Model
 */
class NewMetaMagikSubQuery extends NewTaskFinderModel
{
    const METADATA_TABLE = 'task_has_metadata';
    /**
     * Extended query
     *
     * @access public
     * @return \PicoDb\Table
     */
    public function getExtendedQuery()
    {
        // add subquery to original Model, changing only what we want
        return parent::getExtendedQuery()
            ->subquery('(SELECT COUNT(*) FROM '.self::METADATA_TABLE.' WHERE task_id=tasks.id)', 'nb_metadata');
    }
}