Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3namespace Miniframe\ORM\Engine;
4
5use Miniframe\Core\Config;
6use Miniframe\ORM\Annotation\Column;
7use Miniframe\ORM\Annotation\Table;
8use Miniframe\ORM\Repository\GenericRepository;
9
10interface EngineInterface
11{
12    /**
13     * Initializes a database engine
14     *
15     * @param Config $config Reference to the configuration object.
16     */
17    public function __construct(Config $config);
18
19    /**
20     * Returns the connection of the engine (result may differ per engine)
21     *
22     * @return mixed
23     */
24    public function getConnection();
25
26    /**
27     * Prepares a table
28     *
29     * @param Table    $table   Table metadata.
30     * @param Column[] $columns Column metadata.
31     *
32     * @return void
33     */
34    public function prepareTable(Table $table, array $columns): void;
35
36    /**
37     * Executes a query
38     *
39     * Returns the inserted ID for INSERT queries (int or string)
40     * Returns the amount of affected rows for UPDATE and DELETE queries (int)
41     * Returns a success boolean for all other queries (bool)
42     *
43     * @param string $query      The query.
44     * @param array  $parameters A list of parameters.
45     *
46     * @return integer|string|boolean
47     */
48    public function query(string $query, array $parameters = array());
49
50    /**
51     * Executes a query and returns an array with objects
52     *
53     * @param string $query      The query.
54     * @param array  $parameters A list of parameters.
55     *
56     * @return array[]
57     */
58    public function fetch(string $query, array $parameters = array()): array;
59}