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