api-platform / schema-generator

PHP Model Scaffolding from Schema.org and other RDF vocabularies
https://api-platform.com/docs/schema-generator/
MIT License
453 stars 108 forks source link

feat: repeatable attributes support #394

Closed PawelSuwinski closed 1 year ago

PawelSuwinski commented 1 year ago

Support for repeatable attributes, for example:

Book:
    attributes:
      - ORM\UniqueConstraint: { name: "isbn", columns: ["isbn"] }
      - ORM\UniqueConstraint: { name: "title", columns: ["title"] }
   properties:
      isbn: ~
      title: { range: "https://schema.org/Text" }

gives:

/**
 * A book.
 *
 * @see https://schema.org/Book
 */
#[ORM\Entity]
#[ApiResource(types: ['https://schema.org/Book'], routePrefix: '/library')]
#[ORM\UniqueConstraint(name: 'isbn', columns: ['isbn'])]
#[ORM\UniqueConstraint(name: 'title', columns: ['title'])]
#[MyAttribute]
class Book
{
alanpoulain commented 1 year ago

Thank you @PawelSuwinski.