Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[enhancement] don't make abstract classes and embeddables api resources #72

Open
Evertt opened this issue May 8, 2017 · 2 comments
Open

Comments

@Evertt
Copy link

Evertt commented May 8, 2017

Right now if I have this schema.yml

types:
    Thing:
        properties:
            name: ~

    Person:
        properties:
            familyName: ~

    Country:
        parent: false
        embeddable: true
        properties:
            address: { range: "Text" }

    PostalAddress:
        parent: false
        properties:
            addressCountry: { range: "Country", embedded: true }

It will generate all the entities and all entities are marked as an api resource in the class annotations. The only problem is that you don't want Thing and Country to be api resources. Thing is an abstract class so it can't even be initialized. And since Country is an embeddable it isn't linked to any database table so you can never fetch any countries from the api.

@comxd
Copy link

comxd commented Jan 8, 2018

You can disable some API resources (src/AppBundle/Resources/config/api_resources/resources.yml):

AppBundle\Entity\Thing:
    collectionOperations: {}
    itemOperations: {}
...

@stiivo
Copy link
Contributor

stiivo commented Dec 30, 2022

Sorry for bumping this old issue.

Am I correct in assuming that setting a class as abstract, at least in the past, prevented it from becoming an ApiResource?

#159

It seems that this is no longer the case. I have been helping myself with

        attributes:
            -   ApiResource: { operations: [ ] }

Is it "ok" to do it this way or is it rather not so good?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants