<?php
/********************************************************************************
 * (c)1337 aheadware.com - All rights reserved
 ********************************************************************************/


class Invoice extends AHDB_Core_RestService
{
    public function get()
    {
        if ( $id = $this->params->get('id' ) )
        {
            $entInvoice = AHDMN_Ent_Invoice::get( $id );
            if ( $entInvoice instanceof AHDMN_Ent_Invoice )
            {
                return $entInvoice->asArray();
            }
            else
            {
                return NULL;
            }
        }
        else
        {
            return AHDMN_Ent_Invoice::getAll();
        }
    }
}