PHP Class App\services\ImportService

Show file Open project: hillelcoren/invoice-ninja Class Usage Examples

Public Properties

Property Type Description
$entityTypes array
$results array
$sources array

Protected Properties

Property Type Description
$clientRepo App\Ninja\Repositories\ClientRepository
$contactRepo App\Ninja\Repositories\ContactRepository
$invoiceRepo App\Ninja\Repositories\InvoiceRepository
$processedRows array
$productRepo App\Ninja\Repositories\ProductRepository
$transformer

Public Methods

Method Description
__construct ( League\Fractal\Manager $manager, ClientRepository $clientRepo, InvoiceRepository $invoiceRepo, PaymentRepository $paymentRepo, ContactRepository $contactRepo, ProductRepository $productRepo, ExpenseRepository $expenseRepo, VendorRepository $vendorRepo, ExpenseCategoryRepository $expenseCategoryRepo ) ImportService constructor.
getTransformer ( $source, $entityType, $maps ) : mixed
getTransformerClassName ( $source, $entityType ) : string
importCSV ( array $maps, $headers ) : array
importFiles ( $source, $files ) : array
importJSON ( $file ) : array
mapCSV ( array $files ) : array
mapFile ( $entityType, $filename, $columns, $map ) : array
removeIdFields ( $array ) : mixed

Private Methods

Method Description
addClientToMaps ( Client $client )
addExpenseCategoryToMaps ( ExpenseCategory $category )
addExpenseToMaps ( Expense $expense )
addFailure ( $entityType, $data )
addInvoiceToMaps ( Invoice $invoice )
addProductToMaps ( Product $product )
addSuccess ( $entity )
addVendorToMaps ( Vendor $vendor )
checkClientCount ( $count )
checkData ( $entityType, $count )
checkForMatch ( $column, $pattern ) : boolean
convertToObject ( $entityType, $data, $map ) : stdClas\stdClass
createPayment ( $source, $data, $clientId, $invoiceId )
execute ( $source, $entityType, $file ) : array
executeCSV ( $entityType, $map, $hasHeaders ) : array
init ( )
initMaps ( )
saveData ( $source, $entityType, $row, $data_index ) : mixed
transformRow ( $source, $entityType, $row ) : boolean | mixed

Method Details

__construct() public method

ImportService constructor.
public __construct ( League\Fractal\Manager $manager, ClientRepository $clientRepo, InvoiceRepository $invoiceRepo, PaymentRepository $paymentRepo, ContactRepository $contactRepo, ProductRepository $productRepo, ExpenseRepository $expenseRepo, VendorRepository $vendorRepo, ExpenseCategoryRepository $expenseCategoryRepo )
$manager League\Fractal\Manager
$clientRepo App\Ninja\Repositories\ClientRepository
$invoiceRepo App\Ninja\Repositories\InvoiceRepository
$paymentRepo App\Ninja\Repositories\PaymentRepository
$contactRepo App\Ninja\Repositories\ContactRepository
$productRepo App\Ninja\Repositories\ProductRepository
$expenseRepo App\Ninja\Repositories\ExpenseRepository
$vendorRepo App\Ninja\Repositories\VendorRepository
$expenseCategoryRepo App\Ninja\Repositories\ExpenseCategoryRepository

getTransformer() public static method

public static getTransformer ( $source, $entityType, $maps ) : mixed
$source
$entityType
$maps
return mixed

getTransformerClassName() public static method

public static getTransformerClassName ( $source, $entityType ) : string
$source
$entityType
return string

importCSV() public method

public importCSV ( array $maps, $headers ) : array
$maps array
$headers
return array

importFiles() public method

public importFiles ( $source, $files ) : array
$source
$files
return array

importJSON() public method

public importJSON ( $file ) : array
$file
return array

mapCSV() public method

public mapCSV ( array $files ) : array
$files array
return array

mapFile() public method

public mapFile ( $entityType, $filename, $columns, $map ) : array
$entityType
$filename
$columns
$map
return array

removeIdFields() public method

public removeIdFields ( $array ) : mixed
$array
return mixed

Property Details

$clientRepo protected property

protected ClientRepository,App\Ninja\Repositories $clientRepo
return App\Ninja\Repositories\ClientRepository

$contactRepo protected property

protected ContactRepository,App\Ninja\Repositories $contactRepo
return App\Ninja\Repositories\ContactRepository

$entityTypes public static property

public static array $entityTypes
return array

$invoiceRepo protected property

protected InvoiceRepository,App\Ninja\Repositories $invoiceRepo
return App\Ninja\Repositories\InvoiceRepository

$processedRows protected property

protected array $processedRows
return array

$productRepo protected property

protected ProductRepository,App\Ninja\Repositories $productRepo
return App\Ninja\Repositories\ProductRepository

$results public property

public array $results
return array

$sources public static property

public static array $sources
return array

$transformer protected property

protected $transformer