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 am wondering if there is a more elegant way to handle:
class Foo { /** * @Serializer\Exclude() */ private $bar; public function __construct(Bar $bar) { $this->bar = $bar; } /** * @Serializer\VirtualProperty() * @Serializer\SerializedName("Hello") * @Serializer\XmlElement(cdata=false) */ public function getHello() { return $this->bar->world; }
There is obviously with annotating Bar to use Hello as the serialization name of the world property.
Bar
Hello
world
class Foo { /** * @Serializer\Inline() */ private $bar; public function __construct(Bar $bar) { $this->bar = $bar; }
But what if I do not want to define the mapping of world to Hello within the context of Foo class only?
Foo
Would something like the following make sense?
class Foo { /** * @Serializer\Inline(cdata=false, map = {"Hello": "world"}) */ private $bar; public function __construct(Bar $bar) { $this->bar = $bar; }
The text was updated successfully, but these errors were encountered:
I found a slightly better work around for the current status quo
class Foo { /** * @Serializer\Exclude() */ private $bar; public function __construct(Bar $bar) { $this->bar = $bar; } /** * @Serializer\VirtualProperty() * @Serializer\XmlElement(cdata=false) * @Serializer\XmlKeyValuePairs() * @Serializer\Inline() */ public function getBar() { return [ 'Hello' => $this->bar->world, .. ]; } }
Sorry, something went wrong.
I guess given this, I would say expanding @Inline is probably not sensible.
@Inline
No branches or pull requests
I am wondering if there is a more elegant way to handle:
There is obviously with annotating
Bar
to useHello
as the serialization name of theworld
property.But what if I do not want to define the mapping of
world
toHello
within the context ofFoo
class only?Would something like the following make sense?
The text was updated successfully, but these errors were encountered: