- Make sure you have a Flow package (with models and relations if needed).
- Run the
resource:createcommand 2.1 The resource is the singular entity name, lower case (it will automatically take the plural variant) 2.2 The entity is the full Model class name 2.3 Copy the part after...in yourSettings.yaml
Inside the getAttributes() method of the schema class add all the properties you want to disclose via the api inside the array, i.e.:
public function getAttributes($resource): iterable
{
$attributes = [
'name' => $resource->getName()
];
return $attributes;
}In the above example the name attribute will be disclosed in the api.
Inside the getRelationships() method of the schema class add the relations you want to disclose, i.e.:
public function getRelationships($resource): iterable
{
$relationships = [
'movies' => [
self::RELATIONSHIP_DATA => $resource->getMovies()
]
];
return $relationships;
}In order for the changes to come through, you will have to force flush the flow caches:
./flow flow:cache:flush --force.
Make sure your pointer to the adapter class is set correctly inside your Settings.yaml.
Try force clearing caches.
Define configuration in your Settings.yaml.
The related configuration option in Settings.yaml is required. If no definition is needed, set it to an
empty array. @see [create issue]