You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Warning: Declaration of App\Transformers\DepartementTransformer::transform(App\Model\Departement $departement) should be compatible with PhalconRest\Transformers\ModelTransformer::transform($item) in C:\xampp\htdocs\MiC\app\library\App\Transformers\DepartementTransformer.php
`use App\Model\Departement;
use PhalconRest\Transformers\ModelTransformer;
class DepartementTransformer extends ModelTransformer
{
protected $modelClass = Departement::class;
public function transform(Departement $departement)
{
return [
'id' => $this->int($departement->id),
'name' => $departement->name,
];
}
}`
The text was updated successfully, but these errors were encountered:
@rulzi This is actually an expected behaviour. If you override a method in a parent class, the method signature has to be the same as it is in the parent class.
The ModelTransformer class already handles what you've done in your transform method.
See a sample usage here
Warning: Declaration of App\Transformers\DepartementTransformer::transform(App\Model\Departement $departement) should be compatible with PhalconRest\Transformers\ModelTransformer::transform($item) in C:\xampp\htdocs\MiC\app\library\App\Transformers\DepartementTransformer.php
`use App\Model\Departement;
use PhalconRest\Transformers\ModelTransformer;
class DepartementTransformer extends ModelTransformer
{
}`
The text was updated successfully, but these errors were encountered: