- DataObject query plugins
- Learn about some of the useful goodies that come pre-packaged with DataObject queries
- DataObject operation permissions
- A look at how permissions work for DataObject queries and mutations
- DataObject inheritance
- Learn how inheritance is handled in DataObject model types
- Adding DataObject models to the schema
- An overview of how the DataObject model can influence the creation of types, queries, and mutations
- Versioned content
- A guide on how DataObject models with the Versioned extension behave in GraphQL schemas
- Property mapping and dot syntax
- Learn how to customise field names, use dot syntax, and use aggregate functions
- Nested type definitions
- Define dependent types inline with a parent type
Property mapping and dot syntax
For the most part, field names are inferred through the
DataObject model, but its API affords developers full
control over naming.
In this example, we are taking a property
content (which will be defined as
Content in PHP) and defining it
pageContent for GraphQL queries and mutations.
# app/_graphql/models.yml Page: fields: pageContent: type: String property: Content
Property mapping is particularly useful when using dot syntax to access fields.
# app/_graphql/models.yml App\PageType\Blog: fields: title: true authorName: type: String property: 'Author.FirstName'
many_many relationships will automatically convert to a
# app/_graphql/models.yml App\PageType\Blog: fields: title: true categoryTitles: type: '[String]' property: 'Categories.Title' authorsFavourites: type: '[String]' property: 'Author.FavouritePosts.Title'
We can even use a small subset of aggregates, including
# app/_graphql/models.yml App\Model\ProductCategory: fields: title: true productCount: type: Int property: 'Products.Count()' averageProductPrice: type: Float property: 'Products.Avg(Price)'