Skip to content

Commit 9afc517

Browse files
committed
Compatibility with MetaMagik latest version
1 parent 937d225 commit 9afc517

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

Model/NewMetaMagikSubquery.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace Kanboard\Plugin\Group_assign\Model;
4+
5+
use Kanboard\Plugin\Group_assign\Model\NewTaskFinderModel;
6+
7+
/**
8+
* New Task Finder model
9+
* Extends Group_assign Model
10+
*
11+
* @package Kanboard\Plugin\Group_assign\Model
12+
*/
13+
class NewMetaMagikSubQuery extends NewTaskFinderModel
14+
{
15+
const METADATA_TABLE = 'task_has_metadata';
16+
/**
17+
* Extended query
18+
*
19+
* @access public
20+
* @return \PicoDb\Table
21+
*/
22+
public function getExtendedQuery()
23+
{
24+
// add subquery to original Model, changing only what we want
25+
return parent::getExtendedQuery()
26+
->subquery('(SELECT COUNT(*) FROM '.self::METADATA_TABLE.' WHERE task_id=tasks.id)', 'nb_metadata');
27+
}
28+
}

Model/OldMetaMagikSubquery.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace Kanboard\Plugin\Group_assign\Model;
4+
5+
use Kanboard\Plugin\Group_assign\Model\OldTaskFinderModel;
6+
7+
/**
8+
* New Task Finder model
9+
* Extends Group_assign Model
10+
*
11+
* @package Kanboard\Plugin\Group_assign\Model
12+
*/
13+
class OldMetaMagikSubQuery extends OldTaskFinderModel
14+
{
15+
const METADATA_TABLE = 'task_has_metadata';
16+
/**
17+
* Extended query
18+
*
19+
* @access public
20+
* @return \PicoDb\Table
21+
*/
22+
public function getExtendedQuery()
23+
{
24+
// add subquery to original Model, changing only what we want
25+
return parent::getExtendedQuery()
26+
->subquery('(SELECT COUNT(*) FROM '.self::METADATA_TABLE.' WHERE task_id=tasks.id)', 'nb_metadata');
27+
}
28+
}

0 commit comments

Comments
 (0)