summaryrefslogtreecommitdiffstats
path: root/vendor/ipl/orm/src/UnionModel.php
blob: 5373bb9bc217b51c920d8ebcc5ab6737ca4324b9 (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
29
<?php

namespace ipl\Orm;

use ipl\Sql\Connection;

abstract class UnionModel extends Model
{
    /**
     * Get a UNION query which is tied to this model and the given database connection
     *
     * @param Connection $db
     *
     * @return UnionQuery
     */
    public static function on(Connection $db)
    {
        return (new UnionQuery())
            ->setDb($db)
            ->setModel(new static());
    }

    /**
     * Get the UNION models and columns
     *
     * @return array
     */
    abstract public function getUnions();
}