Files
PHP-EM-DB/interfaces/DataAccessInterface.php
2026-10-29 08:36:44 +09:00

45 lines
1.2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* データアクセスインタフェース
*
* このインタフェースを実装することで、
* 基本的なデータベース操作(CRUD)の統一的な実装を保証します。
*/
interface DataAccessInterface
{
/**
* データを作成(登録)する
*
* @param array $data 登録するデータの配列
* @return bool 成功した場合はtrue、失敗した場合はfalse
*/
public function create(array $data): bool;
/**
* データを読み取る(取得)
*
* @param int|null $id 取得するデータのID(nullの場合は全件取得)
* @return array 取得したデータの配列
*/
public function read(?int $id = null): array;
/**
* データを更新する
*
* @param int $id 更新するデータのID
* @param array $data 更新するデータの配列
* @return bool 成功した場合はtrue、失敗した場合はfalse
*/
public function update(int $id, array $data): bool;
/**
* データを削除する
*
* @param int $id 削除するデータのID
* @return bool 成功した場合はtrue、失敗した場合はfalse
*/
public function delete(int $id): bool;
}