Skip to content

Excluding Fields completely #1120

Description

@kingschnulli

We have some Entity classes that implement custom getter functions which return entities as well, as those are not properties there seems to be no way to exclude them. As soon as the ItemNormalizer uses the ResourceClassResolver to resolve the class for this property it will crash. What is the best way to approach this?

An example would be an Entity like this:

//...
class Category{
  //...
  /**
   * @ORM\OneToMany(targetEntity="Category", mappedBy="parent", cascade={"remove"})
   * @Groups({"read","write"})
   */
  protected $children;

  //Getters, setters etc. here - works fine
  //..

  //Custom method which will fail
  public function getLastLeaf(){
    //Skipping implementation
    return $mySomeOtherEntityRelatedToThis;
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions