We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'm trying to solve problem similar to #448.
I have Department class:
Department
class Department { private $id; public function __construct($id) { $this->$id = $id; } public function getId() { return $this->id; } }
If I define User class like this
User
/** * @Serializer\ExclusionPolicy("ALL") * @Serializer\VirtualProperty( * "dep", * exp="object.getDepartment().getId()", * options={@Serializer\SerializedName("dep")} * ) */ class User { private $id; private $department; public function __construct($id, Department $department) { $this->id = $id; $this->department = $department; } /** * @Serializer\VirtualProperty() * @Serializer\SerializedName("id") */ public function getId() { return $this->id; } public function getDepartment() { return $this->department; } }
then after serialization i get something like:
{"id": 42}
Notice there is no dep field.
dep
At the same time, if I define User as this:
/** * @Serializer\VirtualProperty( * "dep", * exp="object.getDepartment().getId()", * options={@Serializer\SerializedName("dep")} * ) */ class User { /** * @Seializer\Exclude() */ private $id; /** * @Seializer\Exclude() */ private $department; public function __construct($id, Department $department) { $this->id = $id; $this->department = $department; } /** * @Serializer\VirtualProperty() * @Serializer\SerializedName("id") */ public function getId() { return $this->id; } public function getDepartment() { return $this->department; } }
I get
{"id": 42, "dep": 12}
It seems that @ExclusionPolicy("ALL") somehow breaks virtual properties based on expression language.
@ExclusionPolicy("ALL")
Am I missing something?
The text was updated successfully, but these errors were encountered:
5f9eed0
thanks for the bug report, has been fixed in 1.6.2
Sorry, something went wrong.
Thank you for the fix 😄
No branches or pull requests
I'm trying to solve problem similar to #448.
I have
Department
class:If I define
User
class like thisthen after serialization i get something like:
Notice there is no
dep
field.At the same time, if I define
User
as this:I get
It seems that
@ExclusionPolicy("ALL")
somehow breaks virtual properties based on expression language.Am I missing something?
The text was updated successfully, but these errors were encountered: