| 1 | <?php |
||
| 8 | abstract class AbstractDatabase implements LoggerAwareInterface, ReadableInterface, WritableInterface |
||
| 9 | { |
||
| 10 | |||
| 11 | private $logger; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * Instantiates the AbstractDatabase. Should be called from inheritors. |
||
| 15 | */ |
||
| 16 | 40 | public function __construct() |
|
| 20 | |||
| 21 | /** |
||
| 22 | * @param string $table The table that will be accessed and written. |
||
| 23 | * @param Condition|null $criteria The criteria that will filter the records. |
||
| 24 | * @param array $options The list of options that will help with finding the records. |
||
| 25 | * @return array|null One record from table, or null if there aren't any matching records. |
||
| 26 | */ |
||
| 27 | 3 | public function find($table, Condition $criteria = null, array $options = []) |
|
| 37 | |||
| 38 | /** |
||
| 39 | * Returns the current logger object. |
||
| 40 | * |
||
| 41 | * @return LoggerInterface |
||
| 42 | */ |
||
| 43 | 2 | public function getLogger() |
|
| 47 | |||
| 48 | /** |
||
| 49 | * Sets the logger to $value. |
||
| 50 | * |
||
| 51 | * @param LoggerInterface $value A logger to be used for this database. |
||
| 52 | * @return void |
||
| 53 | */ |
||
| 54 | public function setLogger(LoggerInterface $value) |
||
| 62 | |||
| 63 | /** |
||
| 64 | * Returns the id of the last record created, or null if no creation took place. |
||
| 65 | * |
||
| 66 | * Must be implemented by inheritors. |
||
| 67 | * |
||
| 68 | * @return mixed |
||
| 69 | */ |
||
| 70 | abstract public function lastIdCreated(); |
||
| 71 | } |
||
| 72 |