1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 21:52:35 +01:00
invoiceninja/app/Ninja/Transformers/EntityTransformer.php

36 lines
942 B
PHP
Raw Normal View History

2015-11-08 22:12:50 +01:00
<?php namespace App\Ninja\Transformers;
use App\Models\Account;
2015-11-27 13:55:28 +01:00
use App\Models\Client;
2015-11-08 22:12:50 +01:00
use League\Fractal\TransformerAbstract;
class EntityTransformer extends TransformerAbstract
{
protected $account;
2015-11-27 13:55:28 +01:00
protected $serializer;
2015-11-08 22:12:50 +01:00
2015-11-27 13:55:28 +01:00
public function __construct(Account $account = null, $serializer = null)
2015-11-08 22:12:50 +01:00
{
$this->account = $account;
2015-11-27 13:55:28 +01:00
$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);
2015-11-08 22:12:50 +01:00
}
}