[MODM-158] Doctrine\ODM\MongoDB\Mapping\Type\TimestampType should use MongoDate instead of MongoTimestamp Created: 24/Nov/11 Updated: 24/Nov/11 |
|
| Status: | Open |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | 1.0.0BETA3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Shane A. Stillwell | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
OS 10.7 PHP 5.3.6 with Suhosin-Patch (cli) (built: Sep 8 2011 19:34:00) |
||
| Attachments: |
|
| Description |
|
When using the @Timestamp mapping type for a class Doctrine uses MongoTimestamp and it creates very incorrect times in the DB. According to PHP documentation, you should not use MongoTimestamp for creating timestamps, instead MongoDate should be used. I've attached a patch that changes it to MongoDate and this works splendid when you assign a timestamp to a @Timestamp value /** * @Field(type="timestamp") */ protected $created_on; /** * @Field(type="timestamp") */ protected $updated_on; public function __construct($options = NULL) { $this->created_on = $this->updated_on = time(); parent::__construct($options); } |