1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-13 06:32:40 +01:00
invoiceninja/app/Ninja/Import/Harvest/ContactTransformer.php

25 lines
681 B
PHP
Raw Normal View History

<?php namespace App\Ninja\Import\Harvest;
2015-12-08 11:10:20 +01:00
use App\Ninja\Import\BaseTransformer;
use League\Fractal\Resource\Item;
2015-12-08 11:10:20 +01:00
class ContactTransformer extends BaseTransformer
{
2015-12-08 11:10:20 +01:00
public function transform($data)
{
2015-12-08 11:10:20 +01:00
if ( ! $this->hasClient($data->client)) {
return false;
}
2015-12-08 11:10:20 +01:00
return new Item($data, function ($data) {
return [
2015-12-08 11:10:20 +01:00
'client_id' => $this->getClientId($data->client),
'first_name' => $data->first_name,
'last_name' => $data->last_name,
'email' => $data->email,
'phone' => $data->office_phone ?: $data->mobile_phone,
];
});
}
}