summaryrefslogtreecommitdiff
path: root/plugins/Group_assign/Model/OldMetaMagikSubquery.php
blob: 787b7e4ac06bc92a9b970b734bc977c4c27a93a9 (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\OldTaskFinderModel;

/**
 * New Task Finder model
 * Extends Group_assign Model
 *
 * @package  Kanboard\Plugin\Group_assign\Model
 */
class OldMetaMagikSubQuery extends OldTaskFinderModel
{
    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');
    }
}