src/Api/Controller/Invoice.php
public function getId($iId = null)
    {
        $oInput = Factory::service('Input');
        $iId    = (int) $iId ?: (int) $oInput->get('id');

        if (empty($iId)) {
            throw new ApiException('Invalid Invoice ID', 404);
        }

        $oInvoiceModel = Factory::model('Invoice', 'nails/module-invoice');
        $oInvoice      = $oInvoiceModel->getById($iId, ['expand' => ['customer']]);

        if (empty($oInvoice)) {
            throw new ApiException('Invalid Invoice ID', 404);
        }

        return Factory::factory('ApiResponse', 'nails/module-api')
                      ->setData($this->formatInvoice($oInvoice));
    }
public function getId($iId = null)
    {
        $oInput = Factory::service('Input');
        $iId    = (int) $iId ?: (int) $oInput->get('id');

        if (empty($iId)) {
            throw new ApiException('Invalid Invoice ID', 404);
        }

        $oInvoiceModel = Factory::model('Invoice', 'nails/module-invoice');
        $oInvoice      = $oInvoiceModel->getById($iId, ['expand' => ['customer']]);

        if (empty($oInvoice)) {
            throw new ApiException('Invalid Invoice ID', 404);
        }

        return Factory::factory('ApiResponse', 'nails/module-api')
                      ->setData($this->formatInvoice($oInvoice));
    }
public function getId ( $ iId = null ) { $ oInput = Factory :: service ( 'Input' ) ; $ iId = ( int ) $ iId ? : ( int ) $ oInput -> get ( 'id' ) ; if ( empty ( $ iId ) ) { throw new ApiException ( 'Invalid Invoice ID' , 404 ) ; } $ oInvoiceModel = Factory :: model ( 'Invoice' , 'nails/module-invoice' ) ; $ oInvoice = $ oInvoiceModel -> getById ( $ iId , [ 'expand' => [ 'customer' ] ] ) ; if ( empty ( $ oInvoice ) ) { throw new ApiException ( 'Invalid Invoice ID' , 404 ) ; } return Factory :: factory ( 'ApiResponse' , 'nails/module-api' ) -> setData ( $ this -> formatInvoice ( $ oInvoice ) ) ; }
Returns an invoice by its ID

@param  string $iId The invoice's ID

@return array
Returns an invoice by its ID