Content-Length: 207912 | pFad | http://github.com/koemeet/JsonApiBundle/issues/33

54 How can I hide certain properties in the response? · Issue #33 · koemeet/JsonApiBundle · GitHub
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

How can I hide certain properties in the response? #33

Open
eloygonzalez opened this issue Jun 11, 2017 · 1 comment
Open

How can I hide certain properties in the response? #33

eloygonzalez opened this issue Jun 11, 2017 · 1 comment

Comments

@eloygonzalez
Copy link

I don't want the attribute "hash" to appear in the response.
How can I hide certain properties in the response?
Thank you!

use Mango\Bundle\JsonApiBundle\Configuration\Annotation as JsonApi;

/**
 * @JsonApi\Resource(type="posts")
 */
 class Post 
 {
    /**
     * @JsonApi\Id
     */
    protected $uuid;
    
    /**
     * @JsonApi\Relationship(includeByDefault=true, showLinkSelf=false, showLinkRelated=false)
     */
    protected $comments;

    protected $hash;
 }
@RuslanZavacky
Copy link

RuslanZavacky commented Jun 11, 2017

@eloygonzalez you have to import JMS serializer and use @JMS\Exclude()

use Mango\Bundle\JsonApiBundle\Configuration\Annotation as JsonApi;
use JMS\Serializer\Annotation as JMS;

/**
 * @JsonApi\Resource(type="posts")
 */
 class Post 
 {
    /**
     * @JsonApi\Id
     */
    protected $uuid;
    
    /**
     * @JsonApi\Relationship(includeByDefault=true, showLinkSelf=false, showLinkRelated=false)
     */
    protected $comments;

    /** @JMS\Exclude() */
    protected $hash;
 }

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

2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/koemeet/JsonApiBundle/issues/33

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy