-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathUnionInternalTable.php
More file actions
46 lines (39 loc) · 1016 Bytes
/
UnionInternalTable.php
File metadata and controls
46 lines (39 loc) · 1016 Bytes
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
declare(strict_types=1);
namespace Atk4\Data\Model;
use Atk4\Core\TrackableTrait;
use Atk4\Data\Exception;
use Atk4\Data\Model;
use Atk4\Data\Persistence;
/**
* Map self::action() to self::getOwner()->actionInnerTable().
*
* Called from https://github.com/atk4/data/blob/5.0.0/src/Persistence/Sql.php#L188.
*
* @method Model getOwner()
*
* @internal
*/
class UnionInternalTable
{
use TrackableTrait;
/**
* @param array<mixed> $args
*
* @return Persistence\Sql\Query
*/
public function action(string $mode, array $args = [])
{
if ($mode !== 'select' || $args !== []) {
throw new Exception('Only "select" action with empty arguments is expected');
}
$model = $this->getOwner();
$tableOrig = $model->table;
$model->table = '_tu';
try {
return $model->actionSelectInnerTable(); // @phpstan-ignore method.notFound
} finally {
$model->table = $tableOrig;
}
}
}