# easy-invoice/2.4.1/includes/Interfaces/InvoiceItemRepositoryInterface.php

Easy Invoice – Invoice Generator, PDF Quotes &amp; Payments, version 2.4.1. 103 lines.

- Page: https://pluginprobe.com/plugins/easy-invoice/2.4.1/code/includes/Interfaces/InvoiceItemRepositoryInterface.php
- Raw: https://pluginprobe.com/plugins/easy-invoice/2.4.1/raw/includes/Interfaces/InvoiceItemRepositoryInterface.php
- Modified: 2025-08-14T09:51:16+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/easy-invoice/2.4.1/code/includes/Interfaces/InvoiceItemRepositoryInterface.php#L10-L20`.

```php
<?php
/**
 * Invoice Item Repository Interface
 *
 * @package Easy_Invoice
 * @subpackage Interfaces
 */

namespace EasyInvoice\Interfaces;

/**
 * InvoiceItemRepositoryInterface
 * 
 * Defines the contract for invoice item repository classes.
 * Invoice items are stored as meta fields within invoice posts.
 */
interface InvoiceItemRepositoryInterface {
    /**
     * Find all items for a specific invoice
     *
     * @param int $invoice_id The invoice ID
     * @return array Array of invoice item data
     */
    public function findByInvoice($invoice_id);
    
    /**
     * Find a specific item by index
     *
     * @param int $invoice_id The invoice ID
     * @param int $item_index The item index (0-based)
     * @return array|null The item data or null if not found
     */
    public function find($invoice_id, $item_index = null);
    
    /**
     * Get all items (for interface compatibility)
     *
     * @param array $args Optional arguments (ignored for meta-based items)
     * @return array Array of invoice item data
     */
    public function all($args = []);
    
    /**
     * Add a new item to an invoice
     *
     * @param int $invoice_id The invoice ID
     * @param array $data The item data
     * @return bool True if successful, false otherwise
     */
    public function create($invoice_id, $data);
    
    /**
     * Update an existing item
     *
     * @param int $invoice_id The invoice ID
     * @param int $item_index The item index (0-based)
     * @param array $data The item data
     * @return bool True if successful, false otherwise
     */
    public function update($invoice_id, $item_index, $data);
    
    /**
     * Delete an item
     *
     * @param int $invoice_id The invoice ID
     * @param int $item_index The item index (0-based)
     * @return bool True if successful, false otherwise
     */
    public function delete($invoice_id, $item_index);
    
    /**
     * Delete all items for an invoice
     *
     * @param int $invoice_id The invoice ID
     * @return bool True if successful, false otherwise
     */
    public function deleteAll($invoice_id);
    
    /**
     * Count items for an invoice
     *
     * @param int $invoice_id The invoice ID
     * @return int The count of items
     */
    public function count($invoice_id);
    
    /**
     * Get total amount for all items in an invoice
     *
     * @param int $invoice_id The invoice ID
     * @return float The total amount
     */
    public function getTotalAmount($invoice_id);
    
    /**
     * Replace all items for an invoice
     *
     * @param int $invoice_id The invoice ID
     * @param array $items Array of item data
     * @return bool True if successful, false otherwise
     */
    public function replaceAll($invoice_id, $items);
} 
```
