Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 1.0.0BETA2
-
Component/s: Mapping Drivers
-
Labels:None
Description
If I have a document which has a EmbeddedDocument and this other name used as the variable name. Thus, when saving but not used by the special reserved name of the variable name. But when read out of the special reserved name is used. so is my EmbeddedDocument always empty when the specific name are different. Furthermore, when I set no specific name for it is also EmbeddedDocument empty.
Example:
/**
* @EmbeddedDocument
*/
class SocialNetworkUser {
/**
* @Int(name="id")
* @var int
*/
protected $id;
/**
* @String(name="fN")
* @var string
*/
protected $firstName;
/**
* @String(name="lN")
* @var string
*/
protected $lastName;
}
/**
* @Document(collection="users")
*/
class User {
/**
* @Id
*/
protected $id;
/**
* @EmbedOne(
* discriminatorField="php",
* discriminatorMap={
* "fbu"="Documents\SocialNetworkUser "
* },
* name="snu",
* cascade={"persist", "remove"}
* )
*/
protected $socialNetworkUser;
}
$user = $this->dm->findOne('Documents\User', array('snu.id' => $this->Facebook->getUser()));
print_r($user->getSocialNetworkUser()):
Documents\SocialNetworkUser Object
(
[id:protected] => // Commented
[firstName:protected] =>
[lastName:protected] =>
)
in Mongo:
Array
(
[_id] => 4c7b4fc3ed1590814d050000
[snu] => Array
(
[id] => // Commented
[firstName] => Thomas
[lastName] => Adam
[php] => fbu
)
)
Correct but should be:
Array
(
[_id] => 4c7b4fc3ed1590814d050000
[snu] => Array
(
[id] => // Commented
[fN] => Thomas
[lN] => Adam
[php] => fbu
)
)
Activity
Thomas Adam
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Description |
If I have a document which has a EmbeddedDocument and this other name used as the variable name. Thus, when saving but not used by the special reserved name of the variable name. But when read out of the special reserved name is used. so is my EmbeddedDocument always empty when the specific name are different. Furthermore, when I set no specific name for it is also EmbeddedDocument empty. Example: /** * @EmbeddedDocument */ class SocialNetworkUser { /** * @Int(name="id") * @var int */ protected $id; /** * @String(name="fN") * @var string */ protected $firstName; /** * @String(name="lN") * @var string */ protected $lastName; } /** * @Document(collection="users") */ class User { /** * @Id */ protected $id; /** * @EmbedOne( * discriminatorField="php", * discriminatorMap={ * "fbu"="Documents\SocialNetworkUser " * }, * name="snu", * cascade={"persist", "remove"} * ) */ protected $socialNetworkUser; } $user = $this->dm->findOne('Documents\User', array('snu.id' => $this->Facebook->getUser())); print_r($user->getSocialNetworkUser()): Documents\Facebook\FacebookUser Object ( [id:protected] => // Commented [firstName:protected] => [lastName:protected] => ) in Mongo: Array ( [_id] => 4c7b4fc3ed1590814d050000 [snu] => Array ( [id] => // Commented [firstName] => Thomas [lastName] => Adam [php] => fbu ) ) Correct but should be: Array ( [_id] => 4c7b4fc3ed1590814d050000 [snu] => Array ( [id] => // Commented [fN] => Thomas [lN] => Adam [php] => fbu ) ) |
If I have a document which has a EmbeddedDocument and this other name used as the variable name. Thus, when saving but not used by the special reserved name of the variable name. But when read out of the special reserved name is used. so is my EmbeddedDocument always empty when the specific name are different. Furthermore, when I set no specific name for it is also EmbeddedDocument empty. Example: [code] /** * @EmbeddedDocument */ class SocialNetworkUser { /** * @Int(name="id") * @var int */ protected $id; /** * @String(name="fN") * @var string */ protected $firstName; /** * @String(name="lN") * @var string */ protected $lastName; } /** * @Document(collection="users") */ class User { /** * @Id */ protected $id; /** * @EmbedOne( * discriminatorField="php", * discriminatorMap={ * "fbu"="Documents\SocialNetworkUser " * }, * name="snu", * cascade={"persist", "remove"} * ) */ protected $socialNetworkUser; } $user = $this->dm->findOne('Documents\User', array('snu.id' => $this->Facebook->getUser())); print_r($user->getSocialNetworkUser()): Documents\Facebook\FacebookUser Object ( [id:protected] => // Commented [firstName:protected] => [lastName:protected] => ) [/code] in Mongo: Array ( [_id] => 4c7b4fc3ed1590814d050000 [snu] => Array ( [id] => // Commented [firstName] => Thomas [lastName] => Adam [php] => fbu ) ) Correct but should be: Array ( [_id] => 4c7b4fc3ed1590814d050000 [snu] => Array ( [id] => // Commented [fN] => Thomas [lN] => Adam [php] => fbu ) ) |
Thomas Adam
made changes -
| Description |
If I have a document which has a EmbeddedDocument and this other name used as the variable name. Thus, when saving but not used by the special reserved name of the variable name. But when read out of the special reserved name is used. so is my EmbeddedDocument always empty when the specific name are different. Furthermore, when I set no specific name for it is also EmbeddedDocument empty. Example: [code] /** * @EmbeddedDocument */ class SocialNetworkUser { /** * @Int(name="id") * @var int */ protected $id; /** * @String(name="fN") * @var string */ protected $firstName; /** * @String(name="lN") * @var string */ protected $lastName; } /** * @Document(collection="users") */ class User { /** * @Id */ protected $id; /** * @EmbedOne( * discriminatorField="php", * discriminatorMap={ * "fbu"="Documents\SocialNetworkUser " * }, * name="snu", * cascade={"persist", "remove"} * ) */ protected $socialNetworkUser; } $user = $this->dm->findOne('Documents\User', array('snu.id' => $this->Facebook->getUser())); print_r($user->getSocialNetworkUser()): Documents\Facebook\FacebookUser Object ( [id:protected] => // Commented [firstName:protected] => [lastName:protected] => ) [/code] in Mongo: Array ( [_id] => 4c7b4fc3ed1590814d050000 [snu] => Array ( [id] => // Commented [firstName] => Thomas [lastName] => Adam [php] => fbu ) ) Correct but should be: Array ( [_id] => 4c7b4fc3ed1590814d050000 [snu] => Array ( [id] => // Commented [fN] => Thomas [lN] => Adam [php] => fbu ) ) |
If I have a document which has a EmbeddedDocument and this other name used as the variable name. Thus, when saving but not used by the special reserved name of the variable name. But when read out of the special reserved name is used. so is my EmbeddedDocument always empty when the specific name are different. Furthermore, when I set no specific name for it is also EmbeddedDocument empty. Example: /** * @EmbeddedDocument */ class SocialNetworkUser { /** * @Int(name="id") * @var int */ protected $id; /** * @String(name="fN") * @var string */ protected $firstName; /** * @String(name="lN") * @var string */ protected $lastName; } /** * @Document(collection="users") */ class User { /** * @Id */ protected $id; /** * @EmbedOne( * discriminatorField="php", * discriminatorMap={ * "fbu"="Documents\SocialNetworkUser " * }, * name="snu", * cascade={"persist", "remove"} * ) */ protected $socialNetworkUser; } $user = $this->dm->findOne('Documents\User', array('snu.id' => $this->Facebook->getUser())); print_r($user->getSocialNetworkUser()): Documents\Facebook\FacebookUser Object ( [id:protected] => // Commented [firstName:protected] => [lastName:protected] => ) in Mongo: Array ( [_id] => 4c7b4fc3ed1590814d050000 [snu] => Array ( [id] => // Commented [firstName] => Thomas [lastName] => Adam [php] => fbu ) ) Correct but should be: Array ( [_id] => 4c7b4fc3ed1590814d050000 [snu] => Array ( [id] => // Commented [fN] => Thomas [lN] => Adam [php] => fbu ) ) |
Thomas Adam
made changes -
| Description |
If I have a document which has a EmbeddedDocument and this other name used as the variable name. Thus, when saving but not used by the special reserved name of the variable name. But when read out of the special reserved name is used. so is my EmbeddedDocument always empty when the specific name are different. Furthermore, when I set no specific name for it is also EmbeddedDocument empty. Example: /** * @EmbeddedDocument */ class SocialNetworkUser { /** * @Int(name="id") * @var int */ protected $id; /** * @String(name="fN") * @var string */ protected $firstName; /** * @String(name="lN") * @var string */ protected $lastName; } /** * @Document(collection="users") */ class User { /** * @Id */ protected $id; /** * @EmbedOne( * discriminatorField="php", * discriminatorMap={ * "fbu"="Documents\SocialNetworkUser " * }, * name="snu", * cascade={"persist", "remove"} * ) */ protected $socialNetworkUser; } $user = $this->dm->findOne('Documents\User', array('snu.id' => $this->Facebook->getUser())); print_r($user->getSocialNetworkUser()): Documents\Facebook\FacebookUser Object ( [id:protected] => // Commented [firstName:protected] => [lastName:protected] => ) in Mongo: Array ( [_id] => 4c7b4fc3ed1590814d050000 [snu] => Array ( [id] => // Commented [firstName] => Thomas [lastName] => Adam [php] => fbu ) ) Correct but should be: Array ( [_id] => 4c7b4fc3ed1590814d050000 [snu] => Array ( [id] => // Commented [fN] => Thomas [lN] => Adam [php] => fbu ) ) |
If I have a document which has a EmbeddedDocument and this other name used as the variable name. Thus, when saving but not used by the special reserved name of the variable name. But when read out of the special reserved name is used. so is my EmbeddedDocument always empty when the specific name are different. Furthermore, when I set no specific name for it is also EmbeddedDocument empty. Example: /** * @EmbeddedDocument */ class SocialNetworkUser { /** * @Int(name="id") * @var int */ protected $id; /** * @String(name="fN") * @var string */ protected $firstName; /** * @String(name="lN") * @var string */ protected $lastName; } /** * @Document(collection="users") */ class User { /** * @Id */ protected $id; /** * @EmbedOne( * discriminatorField="php", * discriminatorMap={ * "fbu"="Documents\SocialNetworkUser " * }, * name="snu", * cascade={"persist", "remove"} * ) */ protected $socialNetworkUser; } $user = $this->dm->findOne('Documents\User', array('snu.id' => $this->Facebook->getUser())); print_r($user->getSocialNetworkUser()): Documents\SocialNetworkUser Object ( [id:protected] => // Commented [firstName:protected] => [lastName:protected] => ) in Mongo: Array ( [_id] => 4c7b4fc3ed1590814d050000 [snu] => Array ( [id] => // Commented [firstName] => Thomas [lastName] => Adam [php] => fbu ) ) Correct but should be: Array ( [_id] => 4c7b4fc3ed1590814d050000 [snu] => Array ( [id] => // Commented [fN] => Thomas [lN] => Adam [php] => fbu ) ) |
Thomas Adam
made changes -
| Component/s | Mapping Drivers [ 10061 ] |
Jonathan H. Wage
made changes -
| Description |
If I have a document which has a EmbeddedDocument and this other name used as the variable name. Thus, when saving but not used by the special reserved name of the variable name. But when read out of the special reserved name is used. so is my EmbeddedDocument always empty when the specific name are different. Furthermore, when I set no specific name for it is also EmbeddedDocument empty. Example: /** * @EmbeddedDocument */ class SocialNetworkUser { /** * @Int(name="id") * @var int */ protected $id; /** * @String(name="fN") * @var string */ protected $firstName; /** * @String(name="lN") * @var string */ protected $lastName; } /** * @Document(collection="users") */ class User { /** * @Id */ protected $id; /** * @EmbedOne( * discriminatorField="php", * discriminatorMap={ * "fbu"="Documents\SocialNetworkUser " * }, * name="snu", * cascade={"persist", "remove"} * ) */ protected $socialNetworkUser; } $user = $this->dm->findOne('Documents\User', array('snu.id' => $this->Facebook->getUser())); print_r($user->getSocialNetworkUser()): Documents\SocialNetworkUser Object ( [id:protected] => // Commented [firstName:protected] => [lastName:protected] => ) in Mongo: Array ( [_id] => 4c7b4fc3ed1590814d050000 [snu] => Array ( [id] => // Commented [firstName] => Thomas [lastName] => Adam [php] => fbu ) ) Correct but should be: Array ( [_id] => 4c7b4fc3ed1590814d050000 [snu] => Array ( [id] => // Commented [fN] => Thomas [lN] => Adam [php] => fbu ) ) |
If I have a document which has a EmbeddedDocument and this other name used as the variable name. Thus, when saving but not used by the special reserved name of the variable name. But when read out of the special reserved name is used. so is my EmbeddedDocument always empty when the specific name are different. Furthermore, when I set no specific name for it is also EmbeddedDocument empty. Example: {code} /** * @EmbeddedDocument */ class SocialNetworkUser { /** * @Int(name="id") * @var int */ protected $id; /** * @String(name="fN") * @var string */ protected $firstName; /** * @String(name="lN") * @var string */ protected $lastName; } /** * @Document(collection="users") */ class User { /** * @Id */ protected $id; /** * @EmbedOne( * discriminatorField="php", * discriminatorMap={ * "fbu"="Documents\SocialNetworkUser " * }, * name="snu", * cascade={"persist", "remove"} * ) */ protected $socialNetworkUser; } $user = $this->dm->findOne('Documents\User', array('snu.id' => $this->Facebook->getUser())); print_r($user->getSocialNetworkUser()): Documents\SocialNetworkUser Object ( [id:protected] => // Commented [firstName:protected] => [lastName:protected] => ) {code} in Mongo: {code} Array ( [_id] => 4c7b4fc3ed1590814d050000 [snu] => Array ( [id] => // Commented [firstName] => Thomas [lastName] => Adam [php] => fbu ) ) Correct but should be: Array ( [_id] => 4c7b4fc3ed1590814d050000 [snu] => Array ( [id] => // Commented [fN] => Thomas [lN] => Adam [php] => fbu ) ) {code} |
Jonathan H. Wage
made changes -
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Fix Version/s | 1.0.0BETA2 [ 10092 ] | |
| Resolution | Fixed [ 1 ] |