mirror of
https://github.com/CachetHQ/Cachet.git
synced 2025-01-17 13:38:20 +01:00
Moved transformers to namespaced directory
This commit is contained in:
parent
15b43dc9a9
commit
4804eb90f8
@ -1,6 +1,12 @@
|
||||
<?php
|
||||
|
||||
class ComponentTransformer extends \League\Fractal\TransformerAbstract {
|
||||
namespace CachetHQ\Cachet\Transformers;
|
||||
|
||||
use Component;
|
||||
use League\Fractal\TransformerAbstract;
|
||||
|
||||
class ComponentTransformer extends TransformerAbstract {
|
||||
|
||||
public function transform(Component $component) {
|
||||
return [
|
||||
'id' => (int) $component->id,
|
||||
@ -13,4 +19,5 @@ class ComponentTransformer extends \League\Fractal\TransformerAbstract {
|
||||
'updated_at' => $component->updated_at->timestamp,
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -1,7 +1,14 @@
|
||||
<?php
|
||||
|
||||
class IncidentTransformer extends \League\Fractal\TransformerAbstract {
|
||||
namespace CachetHQ\Cachet\Transformers;
|
||||
|
||||
use Incident;
|
||||
use League\Fractal\TransformerAbstract;
|
||||
|
||||
class IncidentTransformer extends TransformerAbstract {
|
||||
|
||||
public function transform(Incident $incident) {
|
||||
|
||||
$component = $incident->parent;
|
||||
$transformer = $component->getTransformer();
|
||||
|
@ -1,6 +1,12 @@
|
||||
<?php
|
||||
|
||||
class MetricTransformer extends \League\Fractal\TransformerAbstract {
|
||||
namespace CachetHQ\Cachet\Transformers;
|
||||
|
||||
use Metric;
|
||||
use League\Fractal\TransformerAbstract;
|
||||
|
||||
class MetricTransformer extends ransformerAbstract {
|
||||
|
||||
public function transform(Metric $metric) {
|
||||
return [
|
||||
'id' => (int) $metric->id,
|
||||
@ -12,4 +18,5 @@ class MetricTransformer extends \League\Fractal\TransformerAbstract {
|
||||
'updated_at' => $metric->updated_at->timestamp,
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -35,6 +35,6 @@ class Component extends Eloquent implements \Dingo\Api\Transformer\Transformable
|
||||
* @return ComponentTransformer
|
||||
*/
|
||||
public function getTransformer() {
|
||||
return new ComponentTransformer();
|
||||
return new CachetHQ\Cachet\Transformers\ComponentTransformer();
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@
|
||||
use Watson\Validating\ValidatingTrait;
|
||||
|
||||
class Incident extends Eloquent implements \Dingo\Api\Transformer\TransformableInterface {
|
||||
|
||||
use ValidatingTrait;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingTrait;
|
||||
|
||||
@ -54,6 +55,6 @@ class Incident extends Eloquent implements \Dingo\Api\Transformer\TransformableI
|
||||
* @return IncidentTransformer
|
||||
*/
|
||||
public function getTransformer() {
|
||||
return new IncidentTransformer();
|
||||
return new CachetHQ\Cachet\Transformers\IncidentTransformer();
|
||||
}
|
||||
}
|
@ -24,9 +24,9 @@ class Metric extends Eloquent implements \Dingo\Api\Transformer\TransformableInt
|
||||
/**
|
||||
* Get the transformer instance.
|
||||
*
|
||||
* @return ComponentTransformer
|
||||
* @return MetricTransformer
|
||||
*/
|
||||
public function getTransformer() {
|
||||
return new MetricTransformer();
|
||||
return new CachetHQ\Cachet\Transformers\MetricTransformer();
|
||||
}
|
||||
}
|
@ -19,7 +19,6 @@
|
||||
"app/commands",
|
||||
"app/controllers",
|
||||
"app/models",
|
||||
"app/transformers",
|
||||
"app/database/migrations",
|
||||
"app/database/seeds",
|
||||
"app/tests/TestCase.php",
|
||||
|
0
package.json
Normal file
0
package.json
Normal file
Loading…
x
Reference in New Issue
Block a user