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? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
We are outputting a DateTime as a timestamp in our application. This result is a string, but it would be great if it was an integer.
/** * @JMS\VirtualProperty * @JMS\SerializedName("dateCreated") * @JMS\Type("DateTime<'U'>") */ public function getDateCreated() { return $this->dateCreated; }
Returns:
{ "dateCreated":"1411139100" }
Maybe keep the type of the PHP date call? date('U') returns a number.
Thanks for all your work on this. This is a great library and we're having a lot of fun with it.
-Seth
EDIT: date('U') returns a number, DateTime::format('U') returns a string. sigh PHP...
The text was updated successfully, but these errors were encountered:
Fix bug schmittjoh#343 return integer when the column is datetime
5461933
looks to be a PHP behavior
Sorry, something went wrong.
Easy workarounds starting from 1.6.0:
/** * @Serializer\VirtualProperty( * "dateCreated", * exp="object.getDateCreated().getTimestamp()", * options={@Serializer\Type("integer")} * ) */ class Foo { public function getDateCreated() { return $this->dateCreated; } }
No branches or pull requests
We are outputting a DateTime as a timestamp in our application. This result is a string, but it would be great if it was an integer.
Returns:
Maybe keep the type of the PHP date call? date('U') returns a number.
Thanks for all your work on this. This is a great library and we're having a lot of fun with it.
-Seth
EDIT: date('U') returns a number, DateTime::format('U') returns a string. sigh PHP...
The text was updated successfully, but these errors were encountered: