. */ namespace SP\Repositories; use SP\DataModel\ItemSearchData; use SP\Storage\Database\QueryResult; /** * Interface RepositoryItemInterface * * @package SP\Repositories */ interface RepositoryInterface { /** * Creates an item * * @param mixed $itemData * * @return mixed */ public function create($itemData); /** * Updates an item * * @param mixed $itemData * * @return mixed */ public function update($itemData); /** * Deletes an item * * @param int $id */ public function delete(int $id); /** * Returns the item for given id * * @param int $id * * @return mixed */ public function getById(int $id); /** * Returns all the items */ public function getAll(); /** * Returns all the items for given ids * * @param array $ids * * @return QueryResult */ public function getByIdBatch(array $ids): QueryResult; /** * Deletes all the items for given ids * * @param array $ids * * @return int */ public function deleteByIdBatch(array $ids): int; /** * Checks whether the item is in use or not * * @param $id int * * @return bool */ public function checkInUse(int $id): bool; /** * Checks whether the item is duplicated on updating * * @param mixed $itemData * * @return bool */ public function checkDuplicatedOnUpdate($itemData): bool; /** * Checks whether the item is duplicated on adding * * @param mixed $itemData * * @return bool */ public function checkDuplicatedOnAdd($itemData): bool; /** * Searches for items by a given filter * * @param ItemSearchData $itemSearchData * * @return mixed */ public function search(ItemSearchData $itemSearchData); }