Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.0.0BETA3
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
Description
Documents
class Test
{
.
.
.
/**
* @EmbedOne(targetDocument="Location", name="l")
*/
private $location;
.
.
.
}
/** @EmbeddedDocument */
class Location
{
/**
* @Field(type="float", name="y")
*/
public $lat;
/**
* @Field(type="float", name="x")
*/
public $lng;
public function __construct($latitude,$longitude) {
$this->lat = $latitude;
$this->lng = $longitude;
}
}
Update query:
$dm->createQueryBuilder('Test')
->update()
->field('id')->equals(123)
->field('l')->set(new Location(39, 32);
->getQuery(array('upsert' => true))
->execute();
Result of this query is
"l": { "lat": 39, "lng": 32 }, however, it should be "l": { "y": 39, "x": 32 },
also field function can support field name of the class on update queries, as follows
$dm->createQueryBuilder('Test')
->update()
->field('id')->equals(123)
->field('location')->set(new Location(39, 32);
->getQuery(array('upsert' => true))
->execute();