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
As you can see the order has in the properties _ as in the mapping is defined in the aliases to use -.
<?php
namespace App\Api\V1\Mappings;
use App\Coupon;
use NilPortugues\Api\Mappings\JsonApiMapping;
class CouponMapping implements JsonApiMapping
{
public function getClass()
{
return Coupon::class;
}
/**
* Returns an array of properties that will be renamed.
* Key is current property from the class. Value is the property's alias name.
*
* @return array
*/
public function getAliasedProperties()
{
return [
'coupon_type' => 'coupon-type',
'max_counter' => 'max-counter',
'valid_from' => 'valid-from',
'valid_to' => 'valid-to',
'is_products_only' => 'is-products-only',
'created_at' => 'created-at',
'updated_at' => 'updated-at'
];
}
public function getIdProperties()
{
return ['id'];
}
/**
* Returns an array containing the relationship mappings as an array.
* Key for each relationship defined must match a property of the mapped class.
*
* @return array
*/
public function getRelationships()
{
return [];
}
/**
* Implement the remaining methods from NilPortugues\Api\Mappings\ApiMapping::getRequiredProperti
*/
public function getRequiredProperties()
{
return [];
}
}
It the same for the order relationship. What did I do wrong?
The text was updated successfully, but these errors were encountered:
When I get a resource, the aliases for the properties are well done, but the aliases for the included relationships are not used.
As you can see the order has in the properties
_
as in the mapping is defined in the aliases to use-
.It the same for the order relationship. What did I do wrong?
The text was updated successfully, but these errors were encountered: