mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-14 15:13:29 +01:00
36 lines
942 B
PHP
36 lines
942 B
PHP
<?php namespace App\Ninja\Transformers;
|
|
|
|
use App\Models\Account;
|
|
use App\Models\Client;
|
|
use League\Fractal\TransformerAbstract;
|
|
|
|
class EntityTransformer extends TransformerAbstract
|
|
{
|
|
protected $account;
|
|
protected $serializer;
|
|
|
|
public function __construct(Account $account = null, $serializer = null)
|
|
{
|
|
$this->account = $account;
|
|
$this->serializer = $serializer;
|
|
}
|
|
|
|
protected function includeCollection($data, $transformer, $entityType)
|
|
{
|
|
if ($this->serializer && $this->serializer != API_SERIALIZER_JSON) {
|
|
$entityType = null;
|
|
}
|
|
|
|
return $this->collection($data, $transformer, $entityType);
|
|
}
|
|
|
|
protected function includeItem($data, $transformer, $entityType)
|
|
{
|
|
if ($this->serializer && $this->serializer != API_SERIALIZER_JSON) {
|
|
$entityType = null;
|
|
}
|
|
|
|
return $this->item($data, $transformer, $entityType);
|
|
}
|
|
}
|