[MODM-81] No reference to a loaded document if proxy id = document id Created: 28/Sep/10 Updated: 24/Nov/10 Resolved: 24/Nov/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | UnitOfWork |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Thomas Adam | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
If I load a document and it has an internal reference to the same document with the same ID, only responds to changes in the proxy document. The main document will not be considered and any change has no effect. |
| Comments |
| Comment by Jonathan H. Wage [ 04/Oct/10 ] |
|
Can I see a test case? |
| Comment by Thomas Adam [ 05/Oct/10 ] |
|
test case: http://github.com/tecbot/mongodb-odm/commit/df4e3102b4b29f7e7ad6aa24800457b52f93b14d |
| Comment by Jonathan H. Wage [ 24/Nov/10 ] |
|
Thanks! This is fixed now. The reference will now be the same instance as the root document itself instead of another instance of the same document. |
[MODM-76] I get an error when trying to persist a document Created: 11/Sep/10 Updated: 20/Sep/10 Resolved: 20/Sep/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Sebastian Hoitz | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
This is the error I get: get_class() expects parameter 1 to be object, array given. Stack Trace: #0 [internal function]: {closure}(2, 'get_class() exp...', '/Library/WebSer...', 562, Array)
#1 /Library/WebServer/Documents/ktapi/library/Doctrine/ODM/MongoDB/Persisters/BasicDocumentPersister.php(562): get_class(Array)
#2 /Library/WebServer/Documents/ktapi/library/Doctrine/ODM/MongoDB/Persisters/BasicDocumentPersister.php(545): Doctrine\ODM\MongoDB\Persisters\BasicDocumentPersister->prepareReferencedDocValue(Array, Array)
#3 /Library/WebServer/Documents/ktapi/library/Doctrine/ODM/MongoDB/Persisters/BasicDocumentPersister.php(536): Doctrine\ODM\MongoDB\Persisters\BasicDocumentPersister->prepareValue(Array, Array)
#4 /Library/WebServer/Documents/ktapi/library/Doctrine/ODM/MongoDB/Persisters/BasicDocumentPersister.php(463): Doctrine\ODM\MongoDB\Persisters\BasicDocumentPersister->prepareValue(Array, Array)
#5 /Library/WebServer/Documents/ktapi/library/Doctrine/ODM/MongoDB/Persisters/BasicDocumentPersister.php(209): Doctrine\ODM\MongoDB\Persisters\BasicDocumentPersister->prepareUpdateData(Object(App_Model_Ticket))
#6 /Library/WebServer/Documents/ktapi/library/Doctrine/ODM/MongoDB/UnitOfWork.php(771): Doctrine\ODM\MongoDB\Persisters\BasicDocumentPersister->update(Object(App_Model_Ticket), Array)
#7 /Library/WebServer/Documents/ktapi/library/Doctrine/ODM/MongoDB/UnitOfWork.php(281): Doctrine\ODM\MongoDB\UnitOfWork->executeUpdates(Object(Doctrine\ODM\MongoDB\Mapping\ClassMetadata), Array)
#8 /Library/WebServer/Documents/ktapi/library/Doctrine/ODM/MongoDB/DocumentManager.php(503): Doctrine\ODM\MongoDB\UnitOfWork->commit(Array)
#9 /Library/WebServer/Documents/ktmodels/library/App/Model/Service/Dao/Doctrine.php(26): Doctrine\ODM\MongoDB\DocumentManager->flush()
#10 /Library/WebServer/Documents/ktmodels/library/App/Model/Service/Abstract.php(54): App_Model_Service_Dao_Doctrine->save(Object(App_Model_Ticket))
#11 /Library/WebServer/Documents/ktmodels/library/App/Model/Abstract.php(215): App_Model_Service_Abstract->save(Object(App_Model_Ticket))
#12 /Library/WebServer/Documents/ktmodels/library/App/Model/Ticket.php(84): App_Model_Abstract->save()
#13 /Library/WebServer/Documents/ktapi/application/controllers/TicketController.php(145): App_Model_Ticket->save()
#14 /Library/WebServer/Documents/ktapi/library/Zend/Controller/Action.php(513): TicketController->putAction()
#15 /Library/WebServer/Documents/ktapi/library/Zend/Controller/Dispatcher/Standard.php(295): Zend_Controller_Action->dispatch('putAction')
#16 /Library/WebServer/Documents/ktapi/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#17 /Library/WebServer/Documents/ktapi/library/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()
#18 /Library/WebServer/Documents/ktapi/library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#19 /Library/WebServer/Documents/ktapi/public/index.php(34): Zend_Application->run()
#20 {main}
Please tell me how I can be more precise or of more help. Do you need my models for debugging? (I do not want to post them here). |
| Comments |
| Comment by Sebastian Hoitz [ 11/Sep/10 ] |
|
I got the latest version from Github and this error still occures. I also checked with my models. Before persisting my model with Doctrine all the referenced models are Documents. Somewhere in the Persister the model has to get changed to an array. |
| Comment by Sebastian Hoitz [ 11/Sep/10 ] |
|
The issue seems to be in this http://github.com/doctrine/mongodb-odm/blob/master/lib/Doctrine/ODM/MongoDB/Persisters/BasicDocumentPersister.php#L419 method. When calculating the changeset we end up with an array. When this array is passed on to prepareValue in http://github.com/doctrine/mongodb-odm/blob/master/lib/Doctrine/ODM/MongoDB/Persisters/BasicDocumentPersister.php#L464 this method can not handle the array. I hope this helps a bit with pinpointing the error. |
| Comment by Sebastian Hoitz [ 13/Sep/10 ] |
|
I changed the prepareReferencedDocValue method in BasicDocumentPersister.php to this: private function prepareReferencedDocValue(array $referenceMapping, $document) { $id = null; if (is_array($document)) { $className = $referenceMapping['targetDocument']; } else { $className = get_class($document); $id = $this->uow->getDocumentIdentifier($document); } $class = $this->dm->getClassMetadata($className); if (null !== $id) { $id = $class->getDatabaseIdentifierValue($id); } $ref = array( $this->cmd . 'ref' => $class->getCollection(), $this->cmd . 'id' => $id, $this->cmd . 'db' => $class->getDB() ); if (!isset($referenceMapping['targetDocument'])) { $discriminatorField = isset($referenceMapping['discriminatorField']) ? $referenceMapping['discriminatorField'] : '_doctrine_class_name'; $discriminatorValue = isset($referenceMapping['discriminatorMap']) ? array_search($class->getName(), $referenceMapping['discriminatorMap']) : $class->getName(); $ref[$discriminatorField] = $discriminatorValue; } return $ref; } and this seems to solve the issue. However, I was not able to get the whole Doctrine ODM unit testing set up, so I could not check if all unit tests still pass. I would love if somebody could help me getting the github and unit testing environment for Doctrine set up, so that I can work on some issues too! |
| Comment by Sebastian Hoitz [ 20/Sep/10 ] |
|
Resolved with this commit: http://github.com/sebastianhoitz/mongodb-odm/commit/9ec340697b184284f420e077457127f3147566e0 Includes test case to reproduce the issue. |
[MODM-123] Single Collection Inheritance : hydration won't work properly Created: 17/Feb/11 Updated: 23/Feb/11 Resolved: 23/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | 1.0.0BETA2 |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Billy Bob | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Mac OS X, MAMP |
||
| Description |
|
There is still a problem with Single Collection Inheritance. Please consider the following code :
/**
* @Document(db="forum", collection="Items")
* @InheritanceType("SINGLE_COLLECTION")
* @DiscriminatorField(fieldName="type")
* @DiscriminatorMap({0="Items", 1="Stuffs"})
*/
class Items
{
/**
*
* @id
*/
public $id;
/**
* @String
*/
public $title;
}
/**
* @Document(db="forum", collection="Items")
*/
class Stuffs extends Items
{
/**
*
* @id
*/
public $id;
/**
* @String
*/
public $stuffname;
}
$a = new Stuffs();
$a->stuffname = 'TTT';
$dm->persist($a);
$dm->flush();
Resulting in the database with :
{
"_id": ObjectId("4d5dd082b53251b84e000000"),
"stuffname": "TTT",
"type": 1
}
Now if I do :
$result = $dm->find('Items', $a->id);
then $result is an instance of Stuffs But if I try :
$result = $dm->find('Items', '4d5dd082b53251b84e000000');
then $result is an instance of Items Note that '$a->id' is a string, the same string containing '4d5dd082b53251b84e000000', so :
$result = $dm->find('Items', $a->id);
$result = $dm->find('Items', '4d5dd082b53251b84e000000');
are semantically equivalent. It seems however that hydration would ignore the DiscriminatorMap in the second example. However If you do :
$result = $dm->find('Stuffs', '4d5dd082b53251b84e000000');
You'll get a Stuffs as a result. Now I tried to find a workaround when you don't know the type of the returned object. My initial intention was to first fetch a document with :
$result = $dm->find('Items', '4d5dd082b53251b84e000000');
Then I'm testing a property in the objet to see if it's a Stuffs, if it is, I tried an new :
$result = $dm->find('Stuffs', '4d5dd082b53251b84e000000');
In order to fetch a Stuffs. But ... I still get a *Items"! So basically, if you do :
$result = $dm->find('Stuffs', '4d5dd082b53251b84e000000');
You get a Stuffs. But if you do :
$dm->find('Items', '4d5dd082b53251b84e000000');
$result = $dm->find('Stuffs', '4d5dd082b53251b84e000000');
You get a Items! |
| Comments |
| Comment by Jonathan H. Wage [ 18/Feb/11 ] |
|
Hi, can you make a phpunit testcase here? https://github.com/doctrine/mongodb-odm/tree/master/tests/Doctrine/ODM/MongoDB/Tests/Functional/Ticket |
| Comment by Billy Bob [ 18/Feb/11 ] |
|
Sorry but I'm not familiar with phpunit. If that can help, I've made more tests here. Strangely when I deleted all the documents in the test base and created new ones, the hydration then worken properly! However in my real project, the issue is still here ... In conclusion it seems that the issue is random. |
| Comment by Jonathan H. Wage [ 19/Feb/11 ] |
|
I am not able to produce the issue here. Can you make a executable test that I can run so that I can see what you see? |
| Comment by Billy Bob [ 23/Feb/11 ] |
|
Doesn't seem to be an issue in BETA2. |
[MODM-114] wrong method call in Cursor class Created: 01/Feb/11 Updated: 11/Feb/11 Resolved: 11/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Mongo, MongoCollection, MongoCursor |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Thomas Adam | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
i have found a bug in the Cursor class in mongodb-odm: https://github.com/doctrine/mongodb-odm/blob/master/lib/Doctrine/ODM/MongoDB/Cursor.php#L85 this musst call the current function in the parent class, otherwise mistakes happen when there is a grid fs collection. |
| Comments |
| Comment by Jonathan H. Wage [ 11/Feb/11 ] |
|
This is actually already fixed in the github master. |
[MODM-88] Selecting a subset of properties and then flushing causes database corruption Created: 18/Oct/10 Updated: 24/Nov/10 Resolved: 24/Nov/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Document Manager |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Jay Severson | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Pretty simple to reproduce. Here is the code from our own application. All we wanted to do was to select a subset of fields from the Article document, and found that if we did that and then did anything to cause the DM to mark those documents as modified, when they get flushed to mongo it corrupts your data. For example, article has a property "published" which is set to 1, and after I run this code below, it will set the "published" property to "null" on all documents. $class = 'Bundle\ArticleBundle\Document\Article'; $dm->flush(); |
| Comments |
| Comment by Jonathan H. Wage [ 24/Nov/10 ] |
|
This is not a problem anymore after the recent refactoring. |
[MODM-85] Saving a array over the top of a PersistentCollection results in duplicated data Created: 08/Oct/10 Updated: 24/Nov/10 Resolved: 24/Nov/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Andy Stanberry | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Mongo 1.6.1, opensky/mongo-odm/master |
||
| Description |
|
If you take an document that has a referenceMany and overwrite a PersistentCollection of data with an array, even of the same data, the data is appended to the collection instead of replacing it. |
| Comments |
| Comment by Sebastian Hoitz [ 12/Oct/10 ] |
|
Are you using the most recent version of Doctrine MongoDB ODM? I'm asking because there was a bug fix for something where all embedded documents were duplicated. However I'm also currently investigating a bug where in some cases only one entry does not get removed (although $pullAll is called correctly). |
| Comment by Jonathan H. Wage [ 19/Oct/10 ] |
|
Bulat, this is the same issue where PersistentCollection is never initialized so thats why the array_diff always appends the data with a $pushAll. Remember we talked about it? we can fix it just need to chat about it for a bit. |
| Comment by Jonathan H. Wage [ 24/Nov/10 ] |
|
This is not a problem anymore after the recent refactoring! |
[MODM-65] EmbeddedDocument - Incorrect assignment of special field names on save Created: 30/Aug/10 Updated: 30/Aug/10 Resolved: 30/Aug/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Thomas Adam | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| 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
)
)
|
| Comments |
| Comment by Jonathan H. Wage [ 30/Aug/10 ] |
|
So, basically the name attribute is not being used on embedded documents? |
| Comment by Thomas Adam [ 30/Aug/10 ] |
|
Correct. But when read out of data it is used the name attribute. |
| Comment by Jonathan H. Wage [ 30/Aug/10 ] |
|
Fixed here http://github.com/doctrine/mongodb-odm/commit/3331a91fc628cc2196bcbdc4bbed91d6faa743d3 Thanks, Jon |
[MODM-100] XmlDriver and "discriminatorMap" for "EmbedMany" Created: 09/Dec/10 Updated: 20/Dec/10 Resolved: 20/Dec/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | 1.0.0BETA1 |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Task | Priority: | Critical |
| Reporter: | Vitaliy Kaplich | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
CentOS 5.5 PHP 5.3.3 |
||
| Description |
|
Please correct me if i'm wrong but it looks like that current implementation of XmlDriver does not support the following feature: "discriminatorMap" for "EmbedMany" <?php class User
This feature is very important for our project and without it looks like that we have to move to Docblock annotations instead of XML format which could be rather painful and time consuming. |
| Comments |
| Comment by Jonathan H. Wage [ 15/Dec/10 ] |
|
It looks like it is just missing. I'd be happy to accept a patch if you can provide one |
[MODM-23] Embeded objects gets doubled [see description for the whole scenario] Created: 30/Jun/10 Updated: 13/Jul/10 Resolved: 13/Jul/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical |
| Reporter: | Ahsan Shafiq | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Ubuntu with LAMP. I am using Code Igniter. |
||
| Attachments: |
|
| Description |
|
If you have the database structure as: First, I simply add a glass to table and add that table to group. And create a chair and add it to group also. $group->tables[] = $table; $dm->persist($group); Now I call a function, which adds a new chair; $group->chairs[] = $chair; and as mentioned I traverse on tables to get table names and add those name in a new 'Chair' Collection's tablenames (@Hash). Now in Db I have: Note: As I call "addChair()" one more time the glasses in table get multiplied by two!!! |
| Comments |
| Comment by Bulat Shakirzyanov [ 06/Jul/10 ] |
|
this should be resolved in the current trunk |
[MODM-94] $or operator Created: 26/Oct/10 Updated: 15/Nov/10 Resolved: 15/Nov/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | New Feature | Priority: | Major |
| Reporter: | Julien | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Hello, MongoDB proposes an operator $or http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%24or Can you add this feature in Doctrine\ODM\MongoDB\Query Thank you Julien |
| Comments |
| Comment by Kris Wallsmith [ 01/Nov/10 ] |
|
I've proposed a resolution in the |
| Comment by Kris Wallsmith [ 05/Nov/10 ] |
|
I don't seem to have permission to close this ticket... I merged this change into master. |
[MODM-92] Changing all data in embedMany collections can create duplicate embedded objects Created: 22/Oct/10 Updated: 23/Nov/10 Resolved: 23/Nov/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Persister, UnitOfWork |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Jeremy Mikola | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
MongoDB 1.6.3, with Mongo ODM master as of 10/22/2010 |
||
| Description |
|
Repeatable in the following use case, when the default pushPull strategy is used for an embedMany collection:
I investigated this as best I could, and traced the problem to BasicDocumentPersister::prepareUpdateData() and the data it receives from UnitOfWork's changeset. The UoW changeset simply reports the old/new embedded collections as arrays of raw data. This makes BasicDocumentPersister unable to distinguish whether a $set or $pullAll/$pushAll is an appropriate course of action, since it cannot discern whether the embedded objects are actually different (by SPL object hash) or merely changed. Following the logic in prepareUpdateData(), we end up doing two things when processing the update for the collection field:
This chain of commands will then reach BasicDocumentPersister::update() later on and given the logic check within: > if ((isset($update[$this->cmd . 'pushAll']) || isset($update[$this->cmd . 'pullAll'])) && isset($update[$this->cmd . 'set'])) ... The $set command will be executed first, followed by $pullAll/$pushAll later. This $set actually changes the very data that $pullAll expects to remove, so $pullAll will do nothing but $pushAll will still insert a copy of our new data. The end result is that we now have two copies of our new data in the collection. |
| Comments |
| Comment by Jeremy Mikola [ 22/Oct/10 ] |
|
Failing test case here: http://github.com/jmikola/mongodb-odm/commit/336a700ac6fe0cdf013fc864d8e70f43cb5b73e2 Temporary fix is to switch the mapping strategy to "set" instead of the default "pushPull" I spoke with Bulat and believe the long-term fix for this will be having UoW preserve the SPL object hash of embedded objects in changsets, so that we can compare something more than arrays when deciding what MongoDB commands to utilize. For cases such as this, the $set is superfluous in my opinion - it should only be used if the same object remained in the collection and had its value(s) changed. |
| Comment by Jonathan H. Wage [ 23/Nov/10 ] |
|
Thanks! This is now fixed with the refactoring we did the persisters last week! |
[MODM-93] YAML and XML mapping drivers ignore discriminatorField and discriminatorMap Created: 24/Oct/10 Updated: 24/Nov/10 Resolved: 24/Nov/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | 1.0.0ALPHA1, 1.0.0ALPHA2, 1.0.0BETA1, 1.0.0BETA2 |
| Fix Version/s: | 1.0.0ALPHA1, 1.0.0ALPHA2, 1.0.0BETA1, 1.0.0BETA2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Dan Ordille | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Symony2 |
||
| Description |
|
The discriminatorField and discriminatorMap options are ignored by both the YAML and XML drivers. Example: <?xml version="1.0" encoding="UTF-8"?> <doctrine-mongo-mapping> <document name="Application\Test\Document\Group" collection="groups"> <field name="id" fieldName="id" id="true" /> <field name="name" fieldName="name" type="string" /> <embed-many field="people" discriminator-field="type"> <discriminator-map> <discriminator-mapping class="Admin" value="Admin" /> <discriminator-mapping class="User" value="User" /> </discriminator-map> </embed-many> </document> </doctrine-mongo-mapping> I think that this is also a problem for referenced documents as well, as the code for the two is nearly identical. I refactored addEmbedMapping and addReferenceMapping to call the same function addDocumentMapping |
| Comments |
| Comment by Jonathan H. Wage [ 24/Nov/10 ] |
|
Merged! Thanks for the fix! |
[MODM-91] Document unnecessarily persisted when embedded documents have null properties Created: 20/Oct/10 Updated: 24/Nov/10 Resolved: 24/Nov/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Hydration, Persister, UnitOfWork |
| Affects Version/s: | 1.0.0BETA2 |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Ryan Weaver | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Ubuntu 10.04, PHP 5.3.2, Mongo 1.6.3 |
||
| Description |
|
The setup is a document that has an embedded document. If the embedded document is persisted with at least one field set to null, the changeset for the parent document will include the embedded document, even if no changes have been made. The reason is that the "$orgValue" in UnitOfWork::computeChangeSet() won't contain the null field at all, while the "$actualValue" contains the field properly set to a null value. Test coverage and fix to follow. |
| Comments |
| Comment by Ryan Weaver [ 20/Oct/10 ] |
|
Tests and fix can be found here: http://github.com/weaverryan/mongodb-odm/tree/invalid_changeset_on_null_properties Comments on the change welcome. One unrelated test was affected, which required a fix inside BasicDocumentPersister. |
| Comment by Jonathan H. Wage [ 24/Nov/10 ] |
|
This is fixed now with the latest refactoring of some internal parts. |
[MODM-89] CLONE -UnitOfWork incorrectly updates all documents with embedded documents on flush Created: 19/Oct/10 Updated: 24/Nov/10 Resolved: 24/Nov/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Persister |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Alexander Koß | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
OS X 10.6.4, PHP 5.3.2, Mongo 1.6.3 (can reproduce on Ubuntu 8.04.4 LTS, CentOS, Win 7, etc) |
||
| Description |
|
I use the MODM-83 fix, now i cant delete childrens with a other embedded document: The complete document {
"_id" : ObjectId("4caeea835634c915360a0000"),
"categories" : {
"0" : {
"id" : ObjectId("4cbd55f55634c99177030000"),
"name" : "neue Kategorie",
"questions" : {
"0" : {
"id" : ObjectId("4cbd55f75634c99177040000"),
"name" : "neue Frage",
"relevance" : 0,
"multi" : 0,
"answertype" : 0,
"other" : 0
}
}
}
},
"description" : "pipapo!",
"name" : "ich bin ein Katalog",
"version" : 1
}
Now i add a new answer too the question: The question with the new answer "questions" : { "0" : { "answers" : { "0" : { "id" : ObjectId("4cbd56b95634c99b5b090000"), "name" : "neue Antwort" } }, "answertype" : 0, "id" : ObjectId("4cbd55f75634c99177040000"), "multi" : 0, "name" : "neue Frage", "other" : 0, "relevance" : 0 } } When i delete now the new answer i have a empty array and i cant delete the question from the categorie. The unkillable question "questions" : { "0" : { "answers" : [ ], "answertype" : 0, "id" : ObjectId("4cbd55f75634c99177040000"), "multi" : 0, "name" : "neue Frage", "other" : 0, "relevance" : 0 } } Its a unkillable entry now. |
| Comments |
| Comment by Jonathan H. Wage [ 24/Nov/10 ] |
|
I don't understand the issue. Can you show some php code that shows what you are trying to persist? |
| Comment by Jonathan H. Wage [ 24/Nov/10 ] |
|
I'm pretty certain this is no longer an issue. |
[MODM-87] get_class() expects parameter 1 to be object, array given Created: 12/Oct/10 Updated: 24/Nov/10 Resolved: 24/Nov/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Sebastian Hoitz | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
The commit on October 4th introduced a bug for me. Now I always get an error, because embeddedDocument is an array, and so get_class fails. |
| Comments |
| Comment by Jonathan H. Wage [ 19/Oct/10 ] |
|
Can you give the error you get? maybe the document definitions and code you're using when flushing? |
| Comment by Jonathan H. Wage [ 24/Nov/10 ] |
|
This is not a problem anymore after the recent refactoring! |
[MODM-86] Order of keys in embedded document need to be enforced Created: 11/Oct/10 Updated: 24/Nov/10 Resolved: 24/Nov/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Persister |
| Affects Version/s: | 1.0.0ALPHA1, 1.0.0ALPHA2, 1.0.0BETA1 |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Improvement | Priority: | Major |
| Reporter: | Bulat Shakirzyanov | Assignee: | Bulat Shakirzyanov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Order of keys in embedded bson hashes in mongodb matters, so you can't $pullAll an embedded document if the order of keys is different from the one in mongodb: code , , then query like: code ]}}) would fail, because the order of keys ('zipCode', 'street') is different from the one stored in mongo ('street', 'zipCode'). More can be found here http://jira.mongodb.org/browse/SERVER-1914 Therefore, we need to force the order on every insert and update for consistency. |
| Comments |
| Comment by Jonathan H. Wage [ 24/Nov/10 ] |
|
This is not a problem anymore after the recent refactoring! |
[MODM-84] prePersist and postPersist called twice Created: 06/Oct/10 Updated: 24/Nov/10 Resolved: 24/Nov/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Events |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Jay Severson | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
It appears that the prePersist and postPersist lifecycle events are called twice when persisting and removing a document. Not sure yet if this happens because its an inherited class, will setup a test to try and show behavior. |
| Comments |
| Comment by Jonathan H. Wage [ 08/Oct/10 ] |
|
I tried to setup a test for this but could not replicate it. |
| Comment by Jonathan H. Wage [ 24/Nov/10 ] |
|
This is fixed now as well. |
[MODM-80] Changeset for embedded documents calculates to an unnecessary pullAll() and pushAll() in some cases. Created: 20/Sep/10 Updated: 24/Nov/10 Resolved: 24/Nov/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Persister |
| Affects Version/s: | 1.0.0BETA2 |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Ryan Weaver | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
When embedded documents are persisted and then some of them are removed in just the right way, the resulting update will issue a $pullAll for ALL of the embedded documents and then a $pushAll on whichever embedded documents weren't actually removed. Obviously, only a $pullAll on the removed items is necessary. Additionally, while the $pullAll and the $pushAll seem like they should add up to the correct finish (though inefficient), the removed items appear to not be removed correctly. The $pullAll falls correctly into the if loop found here: http://github.com/doctrine/mongodb-odm/blob/master/lib/Doctrine/ODM/MongoDB/Persisters/BasicDocumentPersister.php#L230, but the end result of that $pullAll in this case is that some items are not removed. A test case for this is here: http://github.com/weaverryan/mongodb-odm/commit/9968697a2c07e31ecfdd8d55ecbf9bf39183d01e. The first case, testModifyGroupsArrayDirectly() tests for this. The second case relates to Thanks - I've found the issue particular strange to nail down and inconsistent. If you spot any issues in my test cases, let me know. |
| Comments |
| Comment by Jonathan H. Wage [ 24/Nov/10 ] |
|
This is not a problem anymore after the recent refactoring! |
[MODM-79] Referenced and Embedded document duplicates are inserted Created: 13/Sep/10 Updated: 24/Nov/10 Resolved: 24/Nov/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Persister |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Sebastian Hoitz | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Description |
|
I have a document with several collections referencing documents in other collections. Doctrine ODM seems to have issues with ArrayCollections and realizing that elements are being taken out. I call ArrayCollection->clear() on those collections but when calculating the changeset Doctrine does not realize that some were deleted. My scenario is following: I have a REST API. On the API I use Doctrine ODM as data backend. Now when I get a request to update an object, I get the passed ID of the object, and populate all the fields. However with collections I call clear() on the collection and then re-add all passed elements. This might not be a very elegant solution, but I don't have to worry about added / changed / deleted items. I pretty much just set a new collection. However, when persisting this document, Doctrine does not seem to notice that I cleared the collection. It just adds all the objects I added to the collection. Therefore I have a lot of duplicate items in my collection. |
| Comments |
| Comment by Alexander Koß [ 15/Sep/10 ] |
|
i have the same problem.
|
| Comment by Ryan Weaver [ 20/Sep/10 ] |
|
I believe I'm replicating this issue and have a test case for it here: http://github.com/weaverryan/mongodb-odm/commit/9968697a2c07e31ecfdd8d55ecbf9bf39183d01e The second test case, testReplaceEntireGroupsArray() displays the above error. The update contains a pushAll() for the one embedded document that remains, but no pullAll() to remove the embedded documents that no longer exist. The first test case, testModifyGroupsArrayDirectly() tests for a different, related issue. I'll open a separate ticket for it. Thanks |
| Comment by Sebastian Hoitz [ 20/Sep/10 ] |
|
It looks like the changeset is calculated correctly. Maybe it has to do with MongoDB's limitation of just sending one atomic operator on one field at a time? Can we use a $set on a collection? Or don't we do this because we would also re-send unmodified entries? |
| Comment by Sebastian Hoitz [ 22/Sep/10 ] |
|
This commit fixed the issue for me: http://github.com/doctrine/mongodb-odm/commit/6b78658b74507edafc59f0ff004d51d6be0e45f5 Thanks @jwage |
| Comment by Jonathan H. Wage [ 24/Nov/10 ] |
|
This is for sure fixed now with our recent refactoring. |
[MODM-78] mappedSuperclass as parent embedded class Created: 13/Sep/10 Updated: 11/Feb/11 Resolved: 11/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Mapping Drivers, Persister |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | julien rollin | Assignee: | Jonathan H. Wage |
| Resolution: | Cannot Reproduce | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Hi, i have 3 documents : a contact, a professional address and a personal address The Contact class inherits from an abstract class DomainAbstract
DomainAbstract is defined as mappedSuperclass Address is defined as mappedSuperclass PersonalAddress, ProfessionalAddress are embeddedDocument But the fields defined by address are not inherited by embedded PersonalAddress and ProfessionalAddress ( but the fields in domainAbstract are like expected) I think, 2 levels of inheritance and embedded document is wrong... thx for help ps: yaml mapping |
| Comments |
| Comment by Jonathan H. Wage [ 24/Nov/10 ] |
|
Could you provide a test case or the files you are using to produce the problem? |
[MODM-74] lifecycleCallbacks are not inherited from mappedSuperclass in yaml mapping Created: 10/Sep/10 Updated: 24/Nov/10 Resolved: 24/Nov/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Bug | Priority: | Major |
| Reporter: | julien rollin | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
The abstract class : abstract class Cgd\DomainObject\DomainObjectAbstract mappedSuperclass #Cgd.DomainObject.DomainObjectAbstract.dcm.yml
Cgd\DomainObject\DomainObjectAbstract:
type: mappedSuperclass
fields:
id:
fieldName: id
id: true
createdAt:
fieldName: createdAt
type: date
updatedAt:
fieldName: updatedAt
type: date
lifecycleCallbacks:
prePersist: [onPreInsert]
preUpdate: [onPreUpdate]
Here the inherited class class App\Entity\Contact\Contact extends Cgd\DomainObject\DomainObjectAbstract InheritedClass #App.Entity.Contact.Contact.dcm.yml
App\Entity\Contact\Contact:
collection: contacts
type: document
fields:
email:
fieldName: email
type: string
status:
fieldName: status
type: int
If i add the lifecycleCallbacks in the InheritedClass yaml config. Events are working |
| Comments |
| Comment by julien rollin [ 10/Sep/10 ] |
|
fixed in current master branch |
[MODM-75] mappedSuperclass and embedded document not working with yaml mapping Created: 10/Sep/10 Updated: 24/Nov/10 Resolved: 24/Nov/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Bug | Priority: | Major |
| Reporter: | julien rollin | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
all documents inherits from an abstract class Cgd\DomainObject\DomainObjectAbstract The document App\Entity\Contact\Contact has many App\Entity\Contact\Program abstract class Cgd\DomainObject\DomainObjectAbstract mappedSuperclass #Cgd.DomainObject.DomainObjectAbstract.dcm.yml
Cgd\DomainObject\DomainObjectAbstract:
type: mappedSuperclass
fields:
id:
fieldName: id
id: true
createdAt:
fieldName: createdAt
type: date
updatedAt:
fieldName: updatedAt
type: date
lifecycleCallbacks:
prePersist: [onPreInsert]
preUpdate: [onPreUpdate]
Here the inherited class class App\Entity\Contact\Contact extends Cgd\DomainObject\DomainObjectAbstract InheritedClass #App.Entity.Contact.Contact.dcm.yml
App\Entity\Contact\Contact:
collection: contacts
type: document
fields:
email:
fieldName: email
type: string
status:
fieldName: status
type: int
embedMany:
programs:
targetDocument: App\Entity\Contact\Program
cascade: all
The embedded class App\Entity\Contact\Program extends Cgd\DomainObject\DomainObjectAbstract embeddedDocument #App.Entity.Contact.Program.dcm.yml
App\Entity\Contact\Program:
type: embeddedDocument
fields:
name:
fieldName: name
type: string
No field from abstract class are populated in embedded document |
| Comments |
| Comment by julien rollin [ 10/Sep/10 ] |
|
if i call $dm->persist($contact); properties createdAt and updatedAt are saved to contact document only if i call $dm->persist($program); properties createdAt and updatedAt are saved to contact and embedded documents. So is it the "cascade: all" property the problem ? |
| Comment by Jonathan H. Wage [ 10/Sep/10 ] |
|
Are you using the absolute latest version from git? we made some changes recently to cascading and embedded documents. It is not necessary anymore to specify any cascading options as it does not make sense for embedded documents. it should and does cascade by default now for embedded documents. |
| Comment by julien rollin [ 10/Sep/10 ] |
|
yes i use the remote origin/master (i just did an update to de2e671201ef5a97e2a970f35cc94b5ad3590bb5) but actually, since your my comments and after yours, i got this beautiful fatal error (unknown before ) Fatal error: Class Doctrine\ODM\MongoDB\Query\Lexer contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Doctrine\Common\Lexer::_getType) in D:\web\php\doctrine2-mongodb\lib\Doctrine\ODM\MongoDB\Query\Lexer.php on line 33 edit : rechecking all dependencies (doctrine/common, etc ) edit 2 : last checkout resolved cascade persist |
[MODM-77] Add "addToSet" strategy for collections / embedMany / referenceMany Created: 13/Sep/10 Updated: 24/Nov/10 Resolved: 24/Nov/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Persister |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Improvement | Priority: | Major |
| Reporter: | Vladimir Razuvaev | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Description |
|
There are cases when collection must not contain duplicates. Mongo has "$addToSet" atomic command for such cases. It would be great to have a separate strategy for that command when persisting collections / embedMany / referenceMany. As far as I understand, Doctrine already supports "set" and "pushPull" strategy, so adding "addToSet" strategy should be possible, right? |
| Comments |
| Comment by Jonathan H. Wage [ 24/Nov/10 ] |
|
Sure, it was simple to add. If you specify $addToSet now it will use that instead of $pushAll to add insert new elements in a collection. |
[MODM-69] implement commands to generate documents Created: 31/Aug/10 Updated: 12/Feb/11 Due: 06/Sep/10 Resolved: 12/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | 1.0.0ALPHA1, 1.0.0ALPHA2, 1.0.0BETA1 |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | New Feature | Priority: | Major |
| Reporter: | Bulat Shakirzyanov | Assignee: | Bulat Shakirzyanov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Comments |
| Comment by Jonathan H. Wage [ 12/Feb/11 ] |
|
https://github.com/doctrine/mongodb-odm/commit/e2b7c35d9baa8444c62348c4132dc6bbb276114d |
[MODM-68] port EntityGenerator to DocumentGenerator Created: 31/Aug/10 Updated: 12/Feb/11 Due: 06/Sep/10 Resolved: 12/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | 1.0.0ALPHA1, 1.0.0ALPHA2, 1.0.0BETA1 |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | New Feature | Priority: | Major |
| Reporter: | Bulat Shakirzyanov | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Comments |
| Comment by Jonathan H. Wage [ 12/Feb/11 ] |
|
Fixed here https://github.com/doctrine/mongodb-odm/commit/e2b7c35d9baa8444c62348c4132dc6bbb276114d |
[MODM-66] Bug when persisting referenced collection Created: 31/Aug/10 Updated: 06/Sep/10 Resolved: 06/Sep/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Persister |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Vladimir Razuvaev | Assignee: | Bulat Shakirzyanov |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
After adding new entry to referenced collection of existing document, ODM generates invalid update query. Here is a test case: /** @Document(db="tests", collection="tests") */ class a { /** @Id */ protected $id; /** @ReferenceMany(targetDocument="b", cascade="all") */ protected $b; function __construct($b) {$this->b = new ArrayCollection($b);} function getB() {return $this->b;} } /** @Document(db="tests", collection="tests2") */ class b { /** @Id */ protected $id; /** @String */ protected $tmp; function __construct($v) {$this->tmp = $v;} } $a = new a(array(new b('first'))); $dm->persist($a); $dm->flush(); // flush causes notices $dm->refresh($a); $a->getB()->add(new b('second')); $dm->persist($a); $dm->flush(); $dm->refresh($a); print_r($a->getB()->toArray()); Expecting following output: Array
(
[0] => b Object
(
[id:protected] => 4c7c9eea0f9d502005000000
[tmp:protected] => first
)
[1] => b Object
(
[id:protected] => 4c7c9eea0f9d502005020000
[tmp:protected] => second
)
)
But getting: Array
(
[0] => b Object
(
[id:protected] => 4c7c9eea0f9d502005000000
[tmp:protected] => first
)
[1] => b Object
(
[id:protected] => 4c7c9eea0f9d502005000000
[tmp:protected] => first
)
[2] => b Object
(
[id:protected] => 4c7c9eea0f9d502005020000
[tmp:protected] => second
)
)
|
| Comments |
| Comment by Bulat Shakirzyanov [ 03/Sep/10 ] |
|
here is a test case for it http://pastie.org/1136303 |
| Comment by Bulat Shakirzyanov [ 03/Sep/10 ] |
|
Jon, fixed here http://github.com/doctrine/mongodb-odm/tree/MODM-66 |
| Comment by Thomas Adam [ 03/Sep/10 ] |
|
Error is not resolved! $b1 = new B('first'); $a = new A(array($b1)); $this->dm->persist($a); $this->dm->flush(); $b2 = new B('second'); $this->dm->refresh($a); // !!!!!!!! $a->getB()->add($b2); $this->dm->flush(); // He now adds the initial values there too. Thus, the array first, first and second! // $this->dm->refresh($a); $b = $a->getB()->toArray(); $this->assertEquals(2, count($b)); $this->assertEquals(array( $b1->getId(), $b2->getId() ), array( $b[0]->getId(), $b[1]->getId() )); |
| Comment by Bulat Shakirzyanov [ 03/Sep/10 ] |
|
looking into it |
| Comment by Bulat Shakirzyanov [ 03/Sep/10 ] |
|
should be fixed here http://github.com/doctrine/mongodb-odm/commits/MODM-66, please test and provide feedback |
| Comment by Thomas Adam [ 03/Sep/10 ] |
|
So the test is working now. But in my documents the problem persists! namespace Documents\Avatar; /** * @Document(collection="avatars") */ class Avatar { /** * @Id */ protected $_id; /** * @String(name="na") * @var string */ protected $_name; /** * @int(name="sex") * @var int */ protected $_sex; /** * @EmbedMany( * targetDocument="Documents\Avatar\AvatarPartTest", * name="aP" * ) * @var array Documents\Avatar\AvatarPartTest */ protected $_avatarParts; /** * Constructor * @param string $name * @param int $sex */ public function __construct($name, $sex, $avatarParts = null) { $this->_name = $name; $this->_sex = $sex; $this->_avatarParts = $avatarParts; } /** * @return string */ public function getId() { return $this->_id; } /** * @return string */ public function getName() { return $this->_name; } /** * @param string $name */ public function setName($name) { $this->_name = $name; } /** * @return int */ public function getSex() { return $this->_sex; } /** * @param int $sex */ public function setSex($sex) { $this->_sex = $sex; } /** * @return array Documents\Avatar\AvatarPartTest */ public function getAvatarParts() { return $this->_avatarParts; } /** * @param Documents\Avatar\AvatarPartTest $part */ public function addAvatarPart($part) { $this->_avatarParts[] = $part; } /** * @param array Documents\Avatar\AvatarPartTest $parts */ public function setAvatarParts($parts) { $this->_avatarParts = $parts; } /** * @param Documents\Avatar\AvatarPartTest $part */ public function removeAvatarPart($part) { $key = array_search($this->_avatarParts, $part); if ($key !== false) { unset($this->_avatarParts[$key]); } } } namespace Documents\Avatar; /** * @EmbeddedDocument */ class AvatarPartTest { /** * @String(name="col") * @var string */ protected $_color; /** * Constructor * @param string $type * @param string $color */ public function __construct($color = null) { $this->_color = $color; } /** * @return string */ public function getColor() { return $this->_color; } /** * @param string $color */ public function setColor($color) { $this->_color = $color; } } And here is my test code: $part = new Documents\Avatar\AvatarPartTest(); $avatar = new Documents\Avatar\Avatar('Test', 1, array($part)); $this->dm->persist($avatar); $this->dm->flush(); $this->dm->refresh($avatar); $this->dm->getUnitOfWork()->computeChangeSets(); $update = $this->dm->getUnitOfWork()->getDocumentPersister('Documents\Avatar\Avatar')->prepareUpdateData($avatar); print_r($update); // print : Array ( [$set] => Array ( [na] => Test [sex] => 1 ) [$pushAll] => Array ( [aP] => Array ( [0] => Array ( ) ) ) ) // That is wrong because it priced the initial values are! $this->dm->flush(); And this is the log: // First insert Array ( [batchInsert] => 1 [num] => 1 [data] => Array ( [0000000061fd6eaa00000000066fdfcd] => Array ( [na] => Test [sex] => 1 [aP] => Array ( [0] => Array ( ) ) ) ) [class] => Documents\Avatar\Avatar [db] =>test [collection] => avatars ) // Refresh findOne // The last flush after refresh // I have made no updates yet he wants to save the entire document again! Array ( [update] => 1 [criteria] => Array ( [_id] => MongoId Object ( ) ) [newObj] => Array ( [$set] => Array ( [na] => Test [sex] => 1 ) ) [options] => Array ( ) [class] => Documents\Avatar\Avatar [db] => test [collection] => avatars ) Array ( [update] => 1 [criteria] => Array ( [_id] => MongoId Object ( ) ) [newObj] => Array ( [$pushAll] => Array ( [aP] => Array ( [0] => Array ( ) ) ) ) [options] => Array ( ) [class] => Documents\Avatar\Avatar [db] => test [collection] => avatars ) |
| Comment by Vladimir Razuvaev [ 04/Sep/10 ] |
|
Still getting same error with example from original post (after odm update). |
| Comment by Bulat Shakirzyanov [ 05/Sep/10 ] |
|
The fix was in the |
| Comment by Vladimir Razuvaev [ 05/Sep/10 ] |
|
Yes, it is fixed now. Thanks a lot! |
| Comment by Thomas Adam [ 06/Sep/10 ] |
|
The upper test works, but not my test! And: $this->dm->getUnitOfWork()->computeChangeSets(); $update = $this->dm->getUnitOfWork()->getDocumentPersister('Documents\Avatar\Avatar')->prepareUpdateData($avatar); still shows all the variables in it are already in Mongo! |
| Comment by Bulat Shakirzyanov [ 06/Sep/10 ] |
|
resolved |
| Comment by Thomas Adam [ 06/Sep/10 ] |
|
So I recorded all the updates, but my test document still does not work. The test for
|
| Comment by Bulat Shakirzyanov [ 06/Sep/10 ] |
|
Thomas, the |
| Comment by Bulat Shakirzyanov [ 06/Sep/10 ] |
|
Thomas, it would help me very much if you created a phpunit test case that fails. |
| Comment by Thomas Adam [ 06/Sep/10 ] |
|
Ok. I added a PHPUnit test case in |
[MODM-64] @DynamicFields Created: 28/Aug/10 Updated: 30/Aug/10 Resolved: 30/Aug/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major |
| Reporter: | Benjamin Eberlei | Assignee: | Jonathan H. Wage |
| Resolution: | Invalid | Votes: | 0 |
| Labels: | None | ||
| Description |
|
I suggest adding a new feature called @DynamicFields. The idea is from roman and documeneted here: http://github.com/romanb/couchdb-persistence-api/blob/master/src/main/java/org/code_factory/couch/annotations/DynamicFields.java Idea: Save all "left-over" fields of the result in an array. This would greatly enhance the flexibility of document mappers |
| Comments |
| Comment by Jonathan H. Wage [ 28/Aug/10 ] |
|
Nice idea! So something like this could essentially work: /** @Document */
class User
{
/** @DynamicFields */
public $data;
}
$user = $dm->find(....);
echo $user->data['username'];
I am not sure if it is a good idea to just allow them to use a single @DynamicFields, maybe we should throw an exception if they use it that way? Also, if they modify a value inside $data should we persist the changes? |
| Comment by Benjamin Eberlei [ 28/Aug/10 ] |
|
i guess the semantics should be, just one dynamic fields per entity allowed and that is inlined into the "normal" fields using array_merge() ? |
| Comment by Benjamin Eberlei [ 29/Aug/10 ] |
|
ok maybe array_merge() is a bit dangerous, when the dynamic field has a property named like a real property. But you could do $data = array_merge($dynamicData, $staticData); and should be fine then semantically, of course this should be documented I think you should have at least an ID or not? but something like this would even be very fast for prototyping: /** @Document */
class User
{
/** @Id @Field */
private $id;
/** @DynamicFields */
public $data;
}
|
| Comment by Jonathan H. Wage [ 29/Aug/10 ] |
|
After thinking about it and discussing it I think the @Collection type can do what is needed: /** @Document */
class User
{
/** @Id */
private $id;
/** @Collection */
public $data = array();
}
|
[MODM-62] PHP warning when array is replaced with ArrayCollection: array_udiff_assoc(): Argument #2 is not an array Created: 28/Aug/10 Updated: 30/Aug/10 Resolved: 30/Aug/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Persister |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Vladimir Razuvaev | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Simple test case to reproduce: /** @Document(db="tests", collection="tests") */ class a { /** @Id */ protected $id; /** @Collection */ protected $b = array('test'); function setB($b) {$this->b = $b;} } $a = new a(); $dm->persist($a); $dm->flush(); $dm->refresh($a); $a->setB(new ArrayCollection(array('test'))); $dm->persist($a); $dm->flush(); Getting PHP warning: PHP Warning: array_udiff_assoc(): Argument #2 is not an array in Doctrine\ODM\MongoDB\Persisters\BasicDocumentPersister.php on line 458 |
| Comments |
| Comment by Jonathan H. Wage [ 30/Aug/10 ] |
|
Thanks, fixed in http://github.com/doctrine/mongodb-odm/commit/c12c9239cf152b4764da07b2bc89bfc6967a9569 |
[MODM-63] More errors when persisting gridfs files Created: 28/Aug/10 Updated: 24/Nov/10 Resolved: 24/Nov/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Persister |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Vladimir Razuvaev | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Getting following errors when trying to persist GridFS file. Trying to get property of non-object in file Doctrine\ODM\MongoDB\MongoCollection.php on line 196 Undefined index: _id in file Doctrine\ODM\MongoDB\Persisters\BasicDocumentPersister.php on line 163 Unfortunately couldn't create reproducable test-case yet, but if that is not an obvious issue, please let me know, I'll try to dig deeper and get the test case. |
| Comments |
| Comment by Jonathan H. Wage [ 30/Aug/10 ] |
|
We'll need a test case, always. Or atleast some kind of pasted code that I can use to produce the issue. |
| Comment by Jonathan H. Wage [ 30/Aug/10 ] |
|
Can you just paste the code that causes the error? Like you have done in previous issues. I can't seem to replicate this one. |
| Comment by Vladimir Razuvaev [ 31/Aug/10 ] |
|
I've found a case when it happens. It is an exceptional situation when someone is trying to persist file without property $file being set. E.g. the case: /** @Document(db="tests", collection="fs") */ class a { /** @Id */ protected $id; /** @File */ protected $file; // note, file is not set /** @String */ protected $c = 'tmp'; } $a = new a(); $dm->persist($a); $dm->flush(); This test case produces notices and warnings. My guess is that it should end up with Exception? |
| Comment by Jonathan H. Wage [ 24/Nov/10 ] |
|
This should be fixed now. |
[MODM-61] GridFs file is stored incorrectly after two flushes Created: 27/Aug/10 Updated: 30/Aug/10 Resolved: 30/Aug/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Persister |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Vladimir Razuvaev | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
GridFs file is stored incorrectly after two flushes. Consider an example: /** @Document(db="tests", collection="fs") */ class File { /** @Id */ protected $id; /** @File */ protected $file; function __construct($source) {$this->file = $source;} } $file = new File(__DIR__ . '/test.txt'); $dm->persist($file); $dm->flush(); $dm->flush(); After second flush, doctrine will also store "file" property as if it was a regular object. Expecting: {
"_id": "4c777fc00f9d505407020000",
"filename": "/test.txt",
"uploadDate": {
"sec": 1282899904,
"usec": 0
},
"length": 10,
"chunkSize": 262144,
"md5": "76ce9f441de2ed5de337d391ad4516b7"
}
Actual result: {
"_id": "4c777f780f9d508416020000",
"chunkSize": 262144,
"file": {
"file": {
"_id": {},
"filename": "/test.txt",
"uploadDate": {
"sec": 1282899832,
"usec": 0
},
"length": 10,
"chunkSize": 262144,
"md5": "76ce9f441de2ed5de337d391ad4516b7"
},
"": {
"w": 1,
"wtimeout": 10000,
"chunks": {
"w": 1,
"wtimeout": 10000
},
"": "fs.chunks"
}
},
"filename": "/test.txt",
"length": 10,
"md5": "76ce9f441de2ed5de337d391ad4516b7",
"uploadDate": {
"sec": 1282899832,
"usec": 0
}
}
P.S. Unfortunately cannot use PHPUnit 3.5 right now to provide unit test. |
| Comments |
| Comment by Jonathan H. Wage [ 30/Aug/10 ] |
|
Fixed by http://github.com/doctrine/mongodb-odm/commit/e8945bc53b59e8c8b8c0b13df0b73a8774c7111b |
[MODM-146] Doctrine MongoDB ODM load referenced documents ends in an endless loop Created: 24/May/11 Updated: 28/May/11 Resolved: 28/May/11 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Hydration |
| Affects Version/s: | 1.0.0BETA3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Stephan Salat | Assignee: | Jonathan H. Wage |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Environment: |
PHP Zend Framework on Ubuntu 10.10 |
||
| Description |
|
Description of the problem here: http://stackoverflow.com/questions/6103483/doctrine-mongodb-odm-load-referenced-documents |
| Comments |
| Comment by Stephan Salat [ 28/May/11 ] |
|
http://stackoverflow.com/questions/6103483/doctrine-mongodb-odm-load-referenced-documents |
[MODM-125] Doctrine\ODM\MongoDB\MongoCollection::findOne does not invoke postFindOne event handlers doing query against MongoGridFS collection Created: 18/Feb/11 Updated: 04/Mar/11 Resolved: 04/Mar/11 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Mongo, MongoCollection, MongoCursor |
| Affects Version/s: | 1.0.0BETA2 |
| Fix Version/s: | 1.0.0BETA3 |
| Type: | Bug | Priority: | Major |
| Reporter: | Vitaliy Kaplich | Assignee: | Jonathan H. Wage |
| Resolution: | Cannot Reproduce | Votes: | 0 |
| Labels: | None | ||
| Environment: |
CentOS, PHP 5.3 |
||
| Description |
|
subj it happens because the code goes out of the function at line 334 in file thanks! |
| Comments |
| Comment by Vitaliy Kaplich [ 18/Feb/11 ] |
|
And the same bug with Doctrine\ODM\MongoDB\MongoCollection::getDBRef method as well |
| Comment by Jonathan H. Wage [ 04/Mar/11 ] |
|
Which version are you using? I don't see this behavior any longer. Can you confirm? |
| Comment by Jonathan H. Wage [ 04/Mar/11 ] |
|
Also, getDBRef() notifies the pre/postGetDBRef events. |
| Comment by Jonathan H. Wage [ 04/Mar/11 ] |
|
If you can still reproduce the issue can you provide a test case for us to run? |
| Comment by Vitaliy Kaplich [ 04/Mar/11 ] |
|
I'm using 1.0.0BETA1 https://github.com/doctrine/mongodb-odm/blob/1.0.0BETA1/lib/Doctrine/ODM/MongoDB/MongoCollection.php there is a "return" at line 338 so the function invoke "preFindOne" but not "postFindOne" |
[MODM-124] ClassMetadata shouldn't store defaultDb value Created: 18/Feb/11 Updated: 04/Mar/11 Resolved: 04/Mar/11 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | 1.0.0BETA2 |
| Fix Version/s: | 1.0.0BETA3 |
| Type: | Bug | Priority: | Major |
| Reporter: | Vladimir Razuvaev | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Currently if document doesn't have "db" mapping, it is taken from defaultDb configuration and assigned to classmetadata (in ClassMetadataFactory). But if we have two documentManagers with different defaultDb configuration, second manager's configuration will be ignored, because "db" value is already set in classMetadata (when the 1st manager was created). It gets worse with metadata caching, as defaultDb setting is only taken in account when metadata is stored in cache. This affects a common use-case, when each customer has his own database and defaultDb is defined at runtime. |
| Comments |
| Comment by Jonathan H. Wage [ 04/Mar/11 ] |
|
Hi, this is fixed here https://github.com/doctrine/mongodb-odm/commit/6b91d944e68bbf94702a38351f03c74b7d6a057a Thanks for reporting the issue. |
[MODM-122] array_slice fails on ReferenceMany and EmbeddedMany fields Created: 17/Feb/11 Updated: 17/Feb/11 Resolved: 17/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | 1.0.0BETA1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Vitaliy Kaplich | Assignee: | Jonathan H. Wage |
| Resolution: | Invalid | Votes: | 0 |
| Labels: | None | ||
| Environment: |
CentOS, PHP 5.3 |
||
| Description |
|
I am not sure if it's a bug of the framework or a bug in implementation of array_slice function in PHP ============================================== I know that PersistentCollection has method "slice" (at least in master branch) but my concern is backward compatibility with the code which treats ReferenceMany type fields as arrays. Please let me know are there any workarounds for this or probably you guys are going to implement some fix? Thanks a lot! |
| Comments |
| Comment by Jonathan H. Wage [ 17/Feb/11 ] |
|
Hi, you need to pass an array so you can convert the iterator to an array with the iterator_to_array() method or call ->toArray() on the PersistentCollection. Then you can pass that array to array_slice() |
[MODM-121] a call of unknown method "setIdentifierValues" in UnitOfWork class Created: 16/Feb/11 Updated: 16/Feb/11 Resolved: 16/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | UnitOfWork |
| Affects Version/s: | 1.0.0BETA1 |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Vitaliy Kaplich | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
On DocumentManager::merge() the following error happens: Fatal error: Call to undefined method Doctrine\ODM\MongoDB\Mapping\ClassMetadata::setIdentifierValues() in /projects/tbi_doctrine/vendors/doctrine/odm/lib/Doctrine/ODM/MongoDB/UnitOfWork.php on line 1378 |
| Comments |
| Comment by Jonathan H. Wage [ 16/Feb/11 ] |
|
This is already resolve in the latest master in git. |
[MODM-119] "strategy" property in @Field annotation is not recognized Created: 10/Feb/11 Updated: 11/Feb/11 Resolved: 11/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | 1.0.0BETA1 |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Vitaliy Kaplich | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Cent OS 5.5, PHP 5.3 |
||
| Description |
|
@Collection(strategy="set") but @Field(type="collection", strategy="set") BadMethodCallException: Unknown property 'strategy' on annotation 'Doctrine\ODM\MongoDB\Mapping\Field'. in /projects/tbi_doctrine/vendors/doctrine/common/lib/Doctrine/Common/Annotations/Annotation.php on line 77 Call Stack: () /projects/tbi_doctrine/lab/doctrine/insert.php:0 |
| Comments |
| Comment by Jonathan H. Wage [ 11/Feb/11 ] |
|
Fixed here https://github.com/doctrine/mongodb-odm/commit/b9bd2dcbab3c8ea2ef537fa1301525b3004ba795 |
[MODM-118] rename "load" method in Proxy object to "__load__" Created: 09/Feb/11 Updated: 11/Feb/11 Resolved: 11/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | 1.0.0BETA1 |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Improvement | Priority: | Major |
| Reporter: | Vitaliy Kaplich | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Cent OS 5.5, PHP 5.3 |
||
| Issue Links: |
|
||||||||
| Description |
|
It would be really great if the method "load" is renamed to something more protected like "__load" or "_doctrineOdmLoad" like it has done for public properties Because otherwise if a referenced document has the same method "load" it causes error like this "Fatal error: Cannot redeclare Proxies\ProjectProxy::load() in /projects/tbi_doctrine/tmp/doctrine/proxies/ProjectProxy.php on line 46" |
| Comments |
| Comment by Jonathan H. Wage [ 11/Feb/11 ] |
|
Fixed for ODM here https://github.com/doctrine/mongodb-odm/commit/bfda83d678af1e2104ce4fba62f9dd47185b210e |
[MODM-117] "name" attribute in @Field annotation Created: 09/Feb/11 Updated: 11/Feb/11 Resolved: 11/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | 1.0.0BETA1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Vitaliy Kaplich | Assignee: | Jonathan H. Wage |
| Resolution: | Cannot Reproduce | Votes: | 0 |
| Labels: | None | ||
| Environment: |
CentOS 5.5, PHP 5.3 |
||
| Description |
|
It looks like that "name" attribute is not supported anymore in @Field annotation http://www.doctrine-project.org/projects/mongodb_odm/1.0/docs/reference/annotations-reference/en#ann_field For instance the code below produces a document inside "mydocs" collection which has only one property "first_name" instead of two: /** @Document(collection="mydocs") */ /** @Field(type="string") */ /** @Field(type="string", name="last_name") */ public function __get($propertyName) } public function __set($propertyName, $propertyValue) { $this->{'_'.$propertyName} = $propertyValue; $doc = new MyDocument(); |
| Comments |
| Comment by Jonathan H. Wage [ 11/Feb/11 ] |
|
I added a test here for your issue and it appears to be working properly in the latest master in git. https://github.com/doctrine/mongodb-odm/commit/cb1cbd2e81b8912dd5959f1d6275443679959a86 |
[MODM-115] Persisting a document which references another document drops ID Created: 03/Feb/11 Updated: 03/Feb/11 Resolved: 03/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Persister |
| Affects Version/s: | 1.0.0BETA2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Robert Knutsson | Assignee: | Jonathan H. Wage |
| Resolution: | Invalid | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Debian, PHP 5.3.3-7 Suhosin fcgi |
||
| Description |
|
I have two documents:
I have an already persisted instance of B, which A references,
I debugged the code and found the error occurs in DocumentPersister.php at line 210 in the latest git version as of this posting.
where $data is:
and $inserts[$oid] becomes:
This assignment makes the MongoID disappear somehow!!? Can't figure it out, could this be a problem with PHP itself? |
| Comments |
| Comment by Robert Knutsson [ 03/Feb/11 ] |
|
The problem occurred since i was dumping the class before it was initialized, not realizing that proxy classes lazy loaded. |
[MODM-113] No options for update queries ? Created: 31/Jan/11 Updated: 11/Feb/11 Resolved: 11/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | 1.0.0BETA2 |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Bug | Priority: | Major |
| Reporter: | JF Bustarret | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
$options are not used for update queries => how can we do an update( {'multiple' => true}) ?
diff -rup doctrine-mongodb-odm-a0667bb/lib/vendor/doctrine-mongodb/lib/Doctrine/MongoDB/Query/Query.php mongodb_odm/lib/vendor/doctrine-mongodb/lib/Doctrine/MongoDB/Query/Query.php
--- doctrine-mongodb-odm-a0667bb/lib/vendor/doctrine-mongodb/lib/Doctrine/MongoDB/Query/Query.php 2011-01-17 06:38:18.000000000 +0100
+++ mongodb_odm/lib/vendor/doctrine-mongodb/lib/Doctrine/MongoDB/Query/Query.php 2011-01-31 17:34:04.000000000 +0100
@@ -172,7 +172,7 @@ class Query implements IteratorAggregate
return $this->collection->insert($this->query['newObj']);
case self::TYPE_UPDATE:
- return $this->collection->update($this->query['query'], $this->query['newObj']);
+ return $this->collection->update($this->query['query'], $this->query['newObj'], $this->options);
case self::TYPE_REMOVE:
return $this->collection->remove($this->query['query'], $this->options);
|
| Comments |
| Comment by Jonathan H. Wage [ 11/Feb/11 ] |
|
Fixed here https://github.com/doctrine/mongodb/commit/9511df1cede93286e8ddaa5dd00c73236fee08bd |
[MODM-108] Random hydratation problem Created: 23/Jan/11 Updated: 25/Jan/11 Resolved: 25/Jan/11 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | 1.0.0BETA1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Billy Bob | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Mac OS X |
||
| Description |
|
I have the following collection named Isboo_Item : { I have a such PHP class : /**
When I'm trying : I get : Fatal error: Uncaught exception 'ReflectionException' with message 'Class 4 does not exist' in /users/developpement/www/library/Doctrine/ODM/MongoDB/Mapping/ClassMetadata.php:285 However the same works fine with another collection : { , , , |
[MODM-107] Document Manager does not delete References Created: 13/Jan/11 Updated: 11/Feb/11 Resolved: 11/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Jan Eichhorn | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Ubuntu Linux 10.04 Maveric PHP 5.3.3 |
||
| Attachments: |
|
| Description |
|
References are not deleted when the function $dm->remove($x) is called. See function: testManyDeleteReference() in attached file. |
| Comments |
| Comment by Jan Eichhorn [ 26/Jan/11 ] |
|
I don't know why Billy Bob has deleted the description? |
| Comment by Jonathan H. Wage [ 11/Feb/11 ] |
|
This is fixed here https://github.com/doctrine/mongodb-odm/commit/1791da1a406d67dc32fcb72cc200ccd2cd6cb828 Thanks for the issue report! |
[MODM-105] inversedBy as ORM Created: 07/Jan/11 Updated: 04/Mar/11 Resolved: 04/Mar/11 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | 1.0.0BETA2 |
| Fix Version/s: | 1.0.0BETA3 |
| Type: | New Feature | Priority: | Major |
| Reporter: | Henrik Bjornskov | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
A way to specify "inversedBy" when mapping referenceOne and referenceMany as the ORM have it. |
| Comments |
| Comment by Jonathan H. Wage [ 11/Feb/11 ] |
|
hmm. I am not sure if having inversedBy makes sense for the mongodb odm based on how references currently work. What would it be used for? relationships in the odm don't work like they do in the orm. We don't use foreign keys to get a reference, we store a reference document on the document that is doing the referencing. |
| Comment by Jonathan H. Wage [ 19/Feb/11 ] |
|
Thinking about this more: /** @Document */
class Product
{
/** @ReferenceOne(targetDocument="Seller") */
private $seller;
}
/** @Document */
class Seller
{
/** @ReferenceMany(targetDocument="Product", inversedBy="seller") */
private $products;
}
Now the $products association will be loaded by running a query like this: db.products.find({ 'seller.$id' : seller.id })
Is this what you mean? |
| Comment by Henrik Bjornskov [ 20/Feb/11 ] |
|
Sorry not getting back to you about this sooner. But that is exactly what i mean |
| Comment by Jonathan H. Wage [ 20/Feb/11 ] |
|
Can you help me think through the other scenariors where it can be used? and how mappedBy would be used. We just need to be sure to think through all the semantics and define it all before I start trying to implement it. |
| Comment by Jonathan H. Wage [ 20/Feb/11 ] |
|
I implemented this here https://github.com/doctrine/mongodb-odm/commit/d1bffbd6bb7b7b690e25f1314f1bf6b69f1e41a6 Can you check it out and give some feedback? |
| Comment by Henrik Bjornskov [ 21/Feb/11 ] |
|
Yes i will play around with it later today |
[MODM-106] $in fails on document identifiers Created: 08/Jan/11 Updated: 11/Feb/11 Resolved: 11/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Document Manager, Document Repositories |
| Affects Version/s: | 1.0.0BETA1 |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Andreas Schmidt | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
If I try to select a couple of documents with the in() query, I receive an empty result set when the selected field is the document id. The following code works fine and selects the right document: $query = $dm->createQueryBuilder("Object\Does\Not\Matter") ->field("id")->equals("4d1db8ba2d8aa162300a0000") ->getQuery()->execute(); Whereas the following query returns nothing: $query = $dm->createQueryBuilder("Object\Does\Not\Matter") ->field("id")->in(array("4d1db8ba2d8aa162300a0000")) ->getQuery()->execute(); |
| Comments |
| Comment by Jonathan H. Wage [ 12/Jan/11 ] |
|
This should be fixed in the latest version in github. I resolved the issues with converting the different types of query parameters |
| Comment by Vladimir Razuvaev [ 02/Feb/11 ] |
|
This is not fixed actually, as there is other issue in DocumentPersister::prepareQueryValue method, unrelated to type converting. e.g. following call will produce unexpectable result: $result = $persister->prepareQueryValue('_id', array('$in' => array(new \MongoId('some_id'))));
// will produce new \MongoId() instead of original array
That's because prepareQueryValue always transforms value for '_id' field to scalar, even if it was originally array, containing $in. |
| Comment by Jonathan H. Wage [ 11/Feb/11 ] |
|
I see better now. I fixed it here https://github.com/doctrine/mongodb-odm/commit/199cab760a7b3cc6a5050111c25e47d4788b310f |
[MODM-104] Creating mongo configuration class instance hangs php Created: 21/Dec/10 Updated: 11/Feb/11 Resolved: 11/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | 1.0.0BETA1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Peter Jasiulewicz | Assignee: | Jonathan H. Wage |
| Resolution: | Cannot Reproduce | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Ubuntu 10.4, PHP 5.3.3, MongoDB 1.6.5, doctrinemongoODM installed with PEAR, also present Doctrine 1.2.3, php handling installed via pecl |
||
| Description |
|
After pasting down the doc tutorial example I've noticed that php hangs on require 'Doctrine/Common/ClassLoader.php'; //-------hangs here //tried explicit too No errors or warnigs of any kind generated. |
| Comments |
| Comment by Jonathan H. Wage [ 23/Dec/10 ] |
|
Hmm, I am not sure this is a problem with any code or anything in the odm, but something wrong with your environment maybe? |
| Comment by Peter Jasiulewicz [ 24/Dec/10 ] |
|
No reason why it would hang on a simple object constucting. I'm using the box for development for a while now, Doctrine 1.2.3 installd too. |
[MODM-102] Documents which belong to global namespace can not be handled? Created: 16/Dec/10 Updated: 11/Feb/11 Resolved: 11/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Hydration |
| Affects Version/s: | 1.0.0BETA2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Vitaliy Kaplich | Assignee: | Jonathan H. Wage |
| Resolution: | Cannot Reproduce | Votes: | 0 |
| Labels: | None | ||
| Environment: |
CentOS 5.5, PHP 5.3.3 |
||
| Description |
|
I'm using xml files to store documents annotations. So lets say I created the following configuration file: .Blackboard_Page.dcm.xml <?xml version="1.0" encoding="utf-8"?> When I try to get the document using the following code: foreach($dm->createQueryBuilder("\Blackboard_Page")... it fails with Exception "Doctrine\ODM\MongoDB\MongoDBException: No identifier/primary key specified for Document 'Blackboard_Page'. Every Document must have an identifier/primary key." The reason of the problem is behavior of the function "get_class". When the code pass an instance of the document which belongs to global namespace the function "get_class()" returns class name without "\" prefix Patching of the method "AbstractFileDriver->findMappingFile" does not help. |
| Comments |
| Comment by Jonathan H. Wage [ 20/Dec/10 ] |
|
When you omit the starting \ does that help? I don't think you need to include it. |
| Comment by Vitaliy Kaplich [ 21/Dec/10 ] |
|
Ok. I'll keep in mind and try later when it become possible and let you know about the result. > I don't think you need to include it. Unfortunately right now I just can not check it. |
[MODM-99] ODM tests drop all collections from all databases on the MongoDB server Created: 08/Dec/10 Updated: 20/Dec/10 Resolved: 20/Dec/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | 1.0.0BETA1 |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Improvement | Priority: | Major |
| Reporter: | Vitaliy Kaplich | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Cent OS 5.5, PHP 5.3.3 |
||
| Description |
|
Recently I run ODM tests in my sandbox and found out that all collections in all databases were dropped after that. After reviewing the code I found out that Doctrine\ODM\MongoDB\Tests\BaseTest->tearDown() method cleans up the whole MongoDB server after running the tests. From one hand such extremely unsafe behavior is not mentioned anywhere from another hand there are no ways to work around it currently but only changing the tests code. It would be really great if there is a way to specify MongoDB connection parameters for ODM tests or at least change tests code in order to drop only databases which were created during the test Thank you. |
[MODM-97] FindAndModify does not return an object Created: 04/Dec/10 Updated: 20/Dec/10 Resolved: 20/Dec/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Document Manager |
| Affects Version/s: | 1.0.0BETA1 |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Bug | Priority: | Major |
| Reporter: | BaÅŸar Aykut | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Windows xp sp3, apache |
||
| Description |
|
Boolean true is returned instead of an object after a FindAndModify command is successfully executed. $c = $dm->createQuery('downloads') echo gettype($c); // boolean |
| Comments |
| Comment by Jonathan H. Wage [ 05/Dec/10 ] |
|
The syntax using the latest version of mongodb odm in git is: $c = $dm->createQuery('downloads')
->findAndUpdate()
->returnNew()
->field('key')->equals('file1')
->field('counter')>inc(1)
->execute();
|
| Comment by BaÅŸar Aykut [ 06/Dec/10 ] |
|
findAndUpdate does not return an object also however it returns an array which includes the object. Is it an expected behavior? And it does not update the record? array(1) {
["4cf9163aff2e00000000154e"]=>
object(downloads)#125 (3) {
["id"]=>string(24) "4cf9163aff2e00000000154e"
["key"] => string(6) "file1"
["counter"] => int(10391)
}
}
|
| Comment by Jonathan H. Wage [ 06/Dec/10 ] |
|
Are you using the latest version of everything? |
| Comment by BaÅŸar Aykut [ 07/Dec/10 ] |
|
I have updated to the latest version in the git. Below query works and returns the updated object as expected. However this is true only for the first call. Repeated calls return the first object . $pid = $dm->createQueryBuilder('downloads')
->findAndUpdate()
->returnNew(true)
->field('key')->equals('file1')
->field('counter')->inc(1)
->getQuery()->execute();
|
| Comment by Jonathan H. Wage [ 07/Dec/10 ] |
|
Hi, I don't follow. Can you show a test of what you are doing? I did a simple test executing a findAndUpdate 2 times in a row and it worked. |
| Comment by BaÅŸar Aykut [ 07/Dec/10 ] |
|
It works but it doesn't return the updated object on subsequent calls. $pid = $dm->createQueryBuilder('downloads')
->findAndUpdate()
->returnNew(true)
->field('key')->equals('file1')
->field('counter')->inc(1)
->getQuery()->execute();
var_dump($pid);
$pid = $dm->createQueryBuilder('downloads')
->findAndUpdate()
->returnNew(true)
->field('key')->equals('file1')
->field('counter')->inc(1)
->getQuery()->execute();
var_dump($pid);
Outputs object(downloads)#112 (3) {
["id"]=>
string(24) "4cfadede55242b0084000003"
["key"]=>
string(6) "file1"
["counter"]=>
int(1)
}
object(downloads)#112 (3) {
["id"]=>
string(24) "4cfadede55242b0084000003"
["key"]=>
string(6) "file1"
["counter"]=>
int(1)
}
// document at the beginning { "_id": "4cfadede55242b0084000003","key": "file1", "counter": 0 } // after the calls { "_id": "4cfadede55242b0084000003","key": "file1", "counter": 2 } |
| Comment by Jonathan H. Wage [ 07/Dec/10 ] |
|
Since Doctrine maintains an identity map, the 2nd time it is not refreshing the documents data. Since it already exists in the identity map it simply returns that document. You can tell Doctrine to refresh the data by doing this: $pid = $dm->createQueryBuilder('downloads')
->findAndUpdate()
->returnNew(true)
->refresh(true)
->field('key')->equals('file1')
->field('counter')->inc(1)
->getQuery()->execute();
|
| Comment by BaÅŸar Aykut [ 09/Dec/10 ] |
|
I don't see any function called refresh? Are you going to add it? I think it would be better to return refreshed data automatically for the findAndUpdate command. |
| Comment by Jonathan H. Wage [ 13/Dec/10 ] |
|
I added it already to the latest version in git. |
[MODM-160] Errors when merging new documents with two levels of embedded documents Created: 11/Jan/12 Updated: 04/Feb/12 Resolved: 04/Feb/12 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | UnitOfWork |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Magnus Nordlander | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Mac OS X 10.7, All code is the latest version of master. |
||
| Description |
|
There's two different error messages that can be found from this. If it's EmbedMany in an array (not an ArrayCollection), the following error message results: Argument 1 passed to Doctrine\ODM\MongoDB\PersistentCollection::__construct() must implement interface Doctrine\Common\Collections\Collection, array given, called in mongodb-odm/lib/Doctrine/ODM/MongoDB/UnitOfWork.php on line 1830 and defined Otherwise it's: Undefined index: <blank> Failing tests have been created and a PR has been submitted on GitHub: https://github.com/doctrine/mongodb-odm/pull/230 |
| Comments |
| Comment by Jonathan H. Wage [ 04/Feb/12 ] |
|
Fixed here https://github.com/doctrine/mongodb-odm/commit/3aca4495eab4fa5e4b6b0034d31dfe37b8f27f70 |
[MODM-166] recomputeSingleDocumentChangeSet does not work for collections Created: 24/Jun/12 Updated: 27/Jun/12 Resolved: 27/Jun/12 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | UnitOfWork |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Tim Roediger | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
If you have a document with a collection, during computation of the changeSet before persist a reference to that collection is placed in originalData, not a copy. Therefore, if you change the collection in an onFlush event listener, then call recomputeSingleDocumentChangeSet, the changes to the collection are not recognised, because the originalData has changed also. I will create a test, and hopefully fix for this soon. |
| Comments |
| Comment by Tim Roediger [ 26/Jun/12 ] |
|
PR open with fix https://github.com/doctrine/mongodb-odm/pull/336 |
| Comment by Tim Roediger [ 27/Jun/12 ] |
|
PR merged |
[MODM-165] Identity map doesn't work (tested only with Symfony) Created: 20/Apr/12 Updated: 20/Apr/12 Resolved: 20/Apr/12 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Ludovic | Assignee: | Jonathan H. Wage |
| Resolution: | Invalid | Votes: | 0 |
| Labels: | None | ||
| Environment: |
mongodb version 2.0.2, mac os x lion, Symfony master |
||
| Description |
|
I tested a basic find (by id) query in Symfony and it seems that the identity map feature does not work. 4 query with a default Doctrine ODM/Symfony configuration give me 4 query in mongostat. |
| Comments |
| Comment by Ludovic [ 20/Apr/12 ] |
|
I misunderstood the identity map usage, actually I discover in the code that it was strictly restricted to find() method and the load method didn't fetch from the identityMap (even if the query carry only an id criteria). I'm not sure of all impact, but I think it could be quite easy to fix this. I'll try to open an issue and maybe to PR. Thanks. |
[MODM-133] array keys with dots aren't persisted for Hash field Created: 21/Mar/11 Updated: 11/Apr/11 Resolved: 11/Apr/11 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | 1.0.0BETA3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | jules b | Assignee: | Jonathan H. Wage |
| Resolution: | Invalid | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Macosx |
||
| Attachments: |
|
| Description |
|
array keys with dots aren't persisted for Hash field in the attachment you will find a complete testcase. thanks. EDIT: use the second attachment |
| Comments |
| Comment by jules b [ 11/Apr/11 ] |
|
it seems that mongodb doesn't allow dots in keys. |
[MODM-8] custom repositories don't work when setting MetadataCacheImpl Created: 22/May/10 Updated: 02/Aug/10 Resolved: 03/Jun/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | 1.0.0ALPHA1 |
| Fix Version/s: | 1.0.0ALPHA1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Onno Schmidt | Assignee: | Jonathan H. Wage |
| Resolution: | Invalid | Votes: | 0 |
| Labels: | None | ||
| Description |
|
When I enable metadataCache: $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ApcCache()); My custom repository stops working. For I example I have a method findAllAssoc. Fatal error: Uncaught exception 'BadMethodCallException' with message 'Undefined method 'findAllAssoc'. The method name must start with either findBy or findOneBy!' in /data/sites/mongodb_odm/lib/Doctrine/ODM/MongoDB/DocumentRepository.php:197 Cheers, Onno |
| Comments |
| Comment by Jonathan H. Wage [ 03/Jun/10 ] |
|
When you enable your metadata cache, it is pulling your mapping information from the cache instead of from your files. So it is probably pulling an older version that does not have the customRepositoryClassName property populated. Clear your metadata cache and it should work fine. |
| Comment by Onno Schmidt [ 02/Aug/10 ] |
|
Somehow, I am still not able to get this to work. Even when I clear the cache I get the message that my custom methods can't be found. I will try to create reproducible case. |
[MODM-7] Fatal error when using a custom repository class in AnnotationDriver Created: 16/May/10 Updated: 09/Jun/10 Resolved: 20/May/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | 1.0.0ALPHA1 |
| Fix Version/s: | 1.0.0ALPHA1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Onno Schmidt | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
When defining a custom repository in an annotation the AnnotationDriver gives an Fatal error on line 105 Call to a member function setCustomRepositoryClass() on a non-object in /data/sites/lib/Doctrine/ODM/MongoDB/Mapping/Driver/AnnotationDriver.php on line 105 replacing: for: solves this issue.. |
[MODM-5] Make embedding work on objects in a collection inheritance tree Created: 14/May/10 Updated: 09/Jun/10 Resolved: 29/May/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | 1.0.0ALPHA1 |
| Fix Version/s: | 1.0.0ALPHA1 |
| Type: | Improvement | Priority: | Major |
| Reporter: | Bulat Shakirzyanov | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
https://gist.github.com/72a8e30931eb56dd84bc |
| Comments |
| Comment by Jonathan H. Wage [ 20/May/10 ] |
|
Can you make a Doctrine test case that I can run more easily? and maybe some information about the issue? |
[MODM-4] tweak xml/yml syntax Created: 11/May/10 Updated: 09/Jun/10 Resolved: 12/May/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | 1.0.0ALPHA1 |
| Fix Version/s: | 1.0.0ALPHA1 |
| Type: | Task | Priority: | Major |
| Reporter: | Bulat Shakirzyanov | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
[15:00] <jwage> we need to write the schema file for the xml |
| Comments |
| Comment by Bulat Shakirzyanov [ 12/May/10 ] |
|
fixed it yesterday |
[MODM-1] Using Doctrine\Common\Collections\Collection Created: 30/Apr/10 Updated: 09/Jun/10 Resolved: 11/May/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | 1.0.0ALPHA1 |
| Fix Version/s: | 1.0.0ALPHA1 |
| Type: | Task | Priority: | Major |
| Reporter: | Roman S. Borschel | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Collections of objects in mongodb entities/documents should be handled like in the ORM through the Common collections. This goes for other potential upcoming projects, like couchdb, too. We should always encourage the use of the Doctrine Common collections in domain models. |
| Comments |
| Comment by Jonathan H. Wage [ 30/Apr/10 ] |
|
I implemented the base usage of the Collection stuff instead of php arrays. I will need your input on the best way to eliminate the loadEntityAssociation(s)() stuff and do something more transparent. |
[MODM-2] Reconsider the naming Created: 30/Apr/10 Updated: 09/Jun/10 Resolved: 30/Apr/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | 1.0.0ALPHA1 |
| Fix Version/s: | 1.0.0ALPHA1 |
| Type: | Task | Priority: | Major |
| Reporter: | Roman S. Borschel | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
We may want to reconsider the naming of things in ODM projects. I know the term "entity" is heavily overloaded but I think there might be a misunderstanding here of what @Entity refers to in the ORM. The ORM @Entity actually means a (relational) database entity (entity relationship diagram, etc...) not the "DDD" entity, of course there are many similarities. I don't feel that comfortable with the possibility of half a dozen different "EntityManager"s, especially if they represent entirely different storage paradigms. Remember, @Entity does not really mean "DDD entity". An EntityManager is not a "DDD entity manager" Do we want X different "EntityManager"s? When considering that @Entity actually refers to a relational database entity, it would make more sense to call these things @Document in the ODM projects, since that is what they're stored as. Then we could instead use the term DocumentManager, and not EntityManager for the ODM projects. I realize that this confusion comes from the fact that many think "entity" = "DDD entity" but that is not the case. @Entity in the ORM refers to a relational database entity just like @Column refers to a relational database column. So my vote currently absolutely goes for @Document and DocumentManager to keep things consistent. Of course, a mongo and a couch project can both have a DocumentManager, that is fine, both storage paradigms are documents. |
| Comments |
| Comment by Jonathan H. Wage [ 30/Apr/10 ] |
|
Agreed. This is great to have you here to provide this kind of valuable input! |
[MODM-59] Exception: "The given document has no identity." when findOne query returns none from a MongoGridFs Created: 25/Aug/10 Updated: 26/Aug/10 Resolved: 26/Aug/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Mongo, MongoCollection, MongoCursor |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Scott Aubrey | Assignee: | Bulat Shakirzyanov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
When running a query against a GridFS that should return no results, I expect the return value to be null (as with normal documents) instead an InvalidArgumentException is thrown, with the message "The given document has no identity". It appears the empty result is trying to be registered as a managed document with the UOW, because MongoCollection does not return null in this case. |
| Comments |
| Comment by Scott Aubrey [ 25/Aug/10 ] |
|
Issue fixed in my git hub branch scottaubrey / mongodb-odm @ pull request sent (sorry not sure how much of this I'm meant to mention here, my first contribution with git and github) |
| Comment by Bulat Shakirzyanov [ 26/Aug/10 ] |
|
http://github.com/doctrine/mongodb-odm/commit/e677f64004b9bc900bfc8f098b15eb24dc3d5262 |
[MODM-58] Update Collection API Created: 24/Aug/10 Updated: 27/Aug/10 Resolved: 27/Aug/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Collections, Mongo, MongoCollection, MongoCursor |
| Affects Version/s: | 1.0.0ALPHA1, 1.0.0ALPHA2, 1.0.0BETA1 |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Improvement | Priority: | Major |
| Reporter: | Bulat Shakirzyanov | Assignee: | Bulat Shakirzyanov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
need to update to reflect this change http://www.doctrine-project.org/jira/browse/DCOM-17 |
| Comments |
| Comment by Bulat Shakirzyanov [ 26/Aug/10 ] |
|
http://github.com/doctrine/mongodb-odm/commit/e46ec823bb1b2b463f4931a0cadfe6c6bd39286d |
| Comment by Bulat Shakirzyanov [ 26/Aug/10 ] |
|
fix typo and add test |
| Comment by Bulat Shakirzyanov [ 27/Aug/10 ] |
|
http://github.com/doctrine/mongodb-odm/commit/298b72378d829c5b7010273981b23fb7f9882d89 |
[MODM-60] Need a way to find all documents from collection by their base class Created: 26/Aug/10 Updated: 31/Aug/10 Resolved: 30/Aug/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Document Manager |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major |
| Reporter: | Vladimir Razuvaev | Assignee: | Jonathan H. Wage |
| Resolution: | Invalid | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Imagine a use case: I have a set of classes, which extend abstract class BaseGridFsFile. All children classess are stored in same GridFs collection (using single collection inheritance). But I cannot fetch all files from this collection, regardless their type. I know that I can use array of subclasses to fetch, but this won't work in my case, because there is no static DiscriminatorMap. It whould be great if I could use something like this: $files = $dm->find('BaseGridFsFile', $query);
and Doctrine would instantiate proper classes for found documents. Is it possible? |
| Comments |
| Comment by Jonathan H. Wage [ 26/Aug/10 ] |
|
It is possible if you have a none abstract parent class that all other subclasses extend from. If you query that class the queries will include a $in query limiting the results to itself and all subclasses using the discriminator values. |
| Comment by Jonathan H. Wage [ 26/Aug/10 ] |
|
Actually it should work even if it is abstract. It just must be a mapped document that has a discriminatorMap specified. |
| Comment by Jonathan H. Wage [ 30/Aug/10 ] |
|
This should work. You can ask usage questions on the mailing list and open an issue for bugs or enhancements. |
| Comment by Vladimir Razuvaev [ 31/Aug/10 ] |
|
Yes, I checked. it works for non-abstract classes, with condition that queried class is in DiscriminatorMap for given collection. But it forces me to rework classes hierarchy to be able to use this feature. I think it would be great to have it work with abstract classes in future versions of ODM. |
[MODM-57] The SchemaManager::createDocumentDB/createDatabases Created: 23/Aug/10 Updated: 24/Aug/10 Resolved: 24/Aug/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | 1.0.0BETA1 |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Bulat Shakirzyanov | Assignee: | Bulat Shakirzyanov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Make ShemaManager execute an arbitrary command on selected db, to trigger actual db creation in SchemaManager::createDocumentDB/createDatabases. |
| Comments |
| Comment by Bulat Shakirzyanov [ 24/Aug/10 ] |
|
http://github.com/doctrine/mongodb-odm/commit/87dfe45ac63818e5a274744bfb46abe63c4fb36d |
[MODM-56] @PreUpdate & EmbedMany Created: 22/Aug/10 Updated: 24/Aug/10 Resolved: 24/Aug/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Persister |
| Affects Version/s: | 1.0.0ALPHA2 |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Bug | Priority: | Major |
| Reporter: | D Ashwood | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
PHP 5.3.2+, Mongodb, recent (varies by developer but all experiencing the same issue) |
||
| Description |
|
Unable to find source-code formatter for language: php. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml // Article namespace Bundle\ArticleBundle\Document; use Bundle\CommentBundle\Document\Comment; use Bundle\ExerciseCommonBundle\Document\Repository; /** * @Document( * collection="article", * indexes={ * @Index(keys={"createdAt"="asc"}) * }, * repositoryClass="Bundle\ArticleBundle\Document\ArticleRepository" * ) * @HasLifecycleCallbacks */ class Article { /** * @Id */ protected $id; /** * @ReferenceOne(targetDocument="Bundle\AccountBundle\Document\User") */ protected $user; /** * @ReferenceOne(targetDocument="Bundle\ArticleBundle\Document\ArticleCategory") * @Validation({ * @NotBlank (message="Please select a category.") * }) */ protected $category; /** * @Field(type="string") */ protected $slug; /** * @Field(type="string") * @Validation({ * @NotBlank (message="You forgot a Title?"), * @MinLength(limit=4, message="Just a little too short.") * }) */ protected $title; /** * @Field(type="string") * @Validation({ * @NotBlank (message="Please summarize your article."), * @MinLength(limit=100, message="Not long enough!"), * @MaxLength(limit=200, message="A wee bit too long.") * }) */ protected $summary; /** * @Field(type="string") * @Validation({ * @NotBlank (message="Where's the beef?") * }) */ protected $body; /** * @EmbedMany(targetDocument="Bundle\CommentBundle\Document\Comment") * */ protected $comments = array(); /** * @Field(type="boolean") */ protected $published = false; /** * @Field(type="date", nullable=false) */ protected $createdAt; /** * @Field(type="date", nullable=false) */ protected $updatedAt; public function getId() { return $this->id; } public function isNew() { return empty($this->id); } public function getUser() { return $this->user; } public function getCategory() { return $this->category; } public function getSlug() { return $this->slug; } public function setSlug($slug) { $this->slug = $slug; } public function setUniqueSlug() { $this->slug = Repository::Slugify($this->title); } public function isPublished() { if($this->published) { return true; } return false; } public function publish() { $this->published = true; } public function unpublish() { $this->published = false; } public function getSummary() { return $this->summary; } public function setSummary($summary) { $this->summary = $summary; } public function getTitle() { return $this->title; } public function setTitle($title) { $this->title = $title; } public function getBody() { return $this->body; } public function setBody($body) { $this->body = $body; } public function setUser($user) { $this->user = $user; } public function setCategory($category) { $this->category = $category; } public function getCreatedAt() { return $this->createdAt; } /** * It can be useful when writing fixtures * @param \DateTime $date * @return void */ public function setCreatedAt(\DateTime $date) { $this->createdAt = $date; } public function getUpdatedAt() { return $this->updatedAt; } public function __toString() { return $this->title(); } /** * @return the $comments */ public function getComments() { return $this->comments; } /** * @param $comments the $comments to set */ public function setComments($comments) { $this->comments = $comments; } /** @PrePersist */ public function incrementCreatedAt() { if(null === $this->createdAt) { $this->createdAt = new \DateTime(); } $this->updatedAt = new \DateTime(); } /** @PreUpdate */ public function incrementUpdatedAt() { $this->updatedAt = new \DateTime(); } public function fromArray(array $array) { foreach($array as $property => $value) { $this->$property = $value; } } } Unable to find source-code formatter for language: php. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml // Comment <?php namespace Bundle\CommentBundle\Document; /** * @EmbeddedDocument */ class Comment { /** * @Id */ protected $id; /** * @Field(type="date", nullable=true) */ protected $createdAt; /** * @Field(type="string", nullable=true) */ protected $message; /** * @ReferenceOne(targetDocument="Bundle\AccountBundle\Document\User") */ protected $user; /** * @return the $createdAt */ public function getCreatedAt() { return $this->createdAt; } /** * @return the $message */ public function getMessage() { return $this->message; } /** * @return the $user */ public function getUser() { return $this->user; } /** * @param $createdAt the $createdAt to set */ public function setCreatedAt($createdAt) { $this->createdAt = $createdAt; } // /** @PrePersist */ // public function incrementCreatedAt() // { // if(null === $this->createdAt) { // $this->createdAt = new \DateTime(); // } // $this->updatedAt = new \DateTime(); // } // // /** @PreUpdate */ // public function incrementUpdatedAt() { // $this->updatedAt = new \DateTime(); // } /** * @param $message the $message to set */ public function setMessage($message) { $this->message = $message; } /** * @param $by_user_id the $by_user_id to set */ public function setUser($user) { $this->user = $user; } } Unable to find source-code formatter for language: php. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml $article = $this->odm->getRepository('Bundle\ArticleBundle\Document\Article')->find("someID"); $newComment = new Comment(); $newComment->setUser($user); $newComment->setMessage("PPPPOOOOOPPPP"); $newComment->setCreatedAt(new \DateTime()); $comments = $article->getComments(); $comments[] = $newComment; $article->setComments($comments); $this->odm->persist($article); // With or without the args to flush $this->odm->flush(array('safe' => true)); With the above - no exception or error is thrown. It appears that the comment is added - but checking the collection in mongo and there's nothing added to the document. |
| Comments |
| Comment by Jonathan H. Wage [ 23/Aug/10 ] |
|
Hi, can you provide a consolidated PHPUnit test case? |
| Comment by D Ashwood [ 23/Aug/10 ] |
|
Just to clarify: $parent = new ParentDocument(); $odm->persist($parent); $odm->flush(); // count(parent->getChildren() ) = 0 // Add some children $childOne = new childEmbededDocument(); $children = $parent->getChildren(); $children[] = $childOne; $parent->setChildren($children); $odm->persist($parent); $childTwo = new childEmbededDocument(); $children = $parent->getChildren(); $children[] = $childTwo; $parent->setChildren($children); $odm->persist($parent); // Results // When $parent has lifeCycle callbacks - specifically @PreUpdate - count(parent->getChildren() ) = 0 // When $parent doesn't have lifeCycle callbacks - count(parent->getChildren() ) = 2 So the issue isn't so much about lifeCycle cascading to the children - it's that the parent lifeCycle callback @PreUpdate affects adding embedded children. |
| Comment by Jonathan H. Wage [ 23/Aug/10 ] |
|
I am still not clear on what the problem is |
| Comment by Jonathan H. Wage [ 23/Aug/10 ] |
|
Fixed by http://github.com/doctrine/mongodb-odm/commit/faf85a281b1562d184b44261a6e4dcdb13e03c5e |
| Comment by Jonathan H. Wage [ 24/Aug/10 ] |
|
The callbacks will also work on embedded documents now. |
[MODM-55] Extract SchemaManager from DocumentManager Created: 19/Aug/10 Updated: 23/Aug/10 Resolved: 23/Aug/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Document Manager |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Improvement | Priority: | Major |
| Reporter: | Bulat Shakirzyanov | Assignee: | Bulat Shakirzyanov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Comments |
| Comment by Bulat Shakirzyanov [ 23/Aug/10 ] |
|
finished here http://github.com/doctrine/mongodb-odm/commit/231dc888be3673658254aad3946e04440400b24c |
[MODM-53] Problems with querying referenced elements Created: 18/Aug/10 Updated: 19/Feb/11 Resolved: 18/Aug/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Sebastian Hoitz | Assignee: | Jonathan H. Wage |
| Resolution: | Invalid | Votes: | 0 |
| Labels: | None | ||
| Description |
|
When trying to query embedded objects, I can use this syntax: object.value = "asd" but when I reference a different collections object, this would give me no result. However, according to http://www.mongodb.org/display/DOCS/Schema+Design#SchemaDesign-Embedvs.Reference this should work the same way. |
| Comments |
| Comment by Jonathan H. Wage [ 18/Aug/10 ] |
|
Can you be more specific what your issue? I can't quite understand what you mean. If you are asking if you can query a referenced document like you can an embedded document, the answer is no. i.e. if you have a document like this: array('username' => 'jwage', 'profile' => array(...dbref....))
You can't query something like "profile.someFieldName" which exists on the referenced document. |
| Comment by Sebastian Hoitz [ 18/Aug/10 ] |
|
But is this a limitation of Doctrine ODM or of MongoDB? Could there be a work-around for this issue? I can see quite a lot of cases where this might be important to do. |
| Comment by Jonathan H. Wage [ 18/Aug/10 ] |
|
It is the way MongoDB works, you have to think about how this is actually being stored and how the dot annotation works for querying. It only works with embedded documents, and the fields of the referenced document aren't embedded, they live somewhere else on another collection and the data is loaded in PHP with another query to mongo. |
[MODM-54] New console commands Created: 19/Aug/10 Updated: 24/Aug/10 Resolved: 24/Aug/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | New Feature | Priority: | Major |
| Reporter: | Jonathan H. Wage | Assignee: | Bulat Shakirzyanov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
We need to add commands for creating and dropping document databases and collections. I added methods to DocumentManager for creating/dropping databases and collections for documents. We have the command for creating indexes, now we need the same for databases and collections. The reason is because you can specify configuration for the collection in the mapping that is used on collection creation: /** @Document(collection={"name"="collname", "capped"="true", "max"="10"}) */
class Document
{}
|
| Comments |
| Comment by Bulat Shakirzyanov [ 23/Aug/10 ] |
|
Jon, these are implemented here http://github.com/doctrine/mongodb-odm/tree/MODM-54, please comment with suggestions, or else I'll merge it in, thanks |
| Comment by Jonathan H. Wage [ 24/Aug/10 ] |
|
Looks good. Once you implement the changes we discussed via jabber you can merge. |
| Comment by Bulat Shakirzyanov [ 24/Aug/10 ] |
|
done |
[MODM-52] Changes of nested embedded collection are not persisted Created: 18/Aug/10 Updated: 18/Aug/10 Resolved: 18/Aug/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Persister |
| Affects Version/s: | 1.0.0BETA1 |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Vladimir Razuvaev | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
When there is a nested EmbedMany collection, changes of this collection are not persisted when saving root document. Maybe simpler to explain with a test case:
/**
* @MappedSuperClass
*/
class container
{
/** @String */
protected $tmp = 'ensureSaved';
/** @EmbedMany(targetDocument="emb", cascade="all", strategy="set") */
protected $items = array();
function __construct($items = null) {if($items) $this->items = $items;}
function getItems() {return $this->items;}
function getItem($index) {return $this->items[$index];}
function removeItem($i) {unset($this->items[$i]);}
}
/** @EmbeddedDocument */
class emb extends container
{}
/** @Document(db="tests", collection="tests") */
class doc extends container
{
/** @Id */
protected $id;
}
$emb = new emb(array(new emb(), new emb()));
$doc = new doc(array($emb));
$dm->persist($doc);
$dm->flush();
$dm->refresh($doc);
// change nested embedded collection:
$doc->getItem(0)->removeItem(1);
$before = count($doc->getItem(0)->getItems());
$dm->persist($doc);
$dm->flush();
$dm->refresh($doc);
$after = count($doc->getItem(0)->getItems());
var_dump($before); // outputs 1
var_dump($after); // outputs 2, but expecting 1
|
| Comments |
| Comment by Vladimir Razuvaev [ 18/Aug/10 ] |
|
I think it might be related to this comment, although not sure. |
| Comment by Jonathan H. Wage [ 18/Aug/10 ] |
|
Thanks for the issue and test! Fixed here http://github.com/doctrine/mongodb-odm/commit/3e71c6a6f99360d88c66043ff989d7671e2ded08 |
[MODM-51] Strange issue with @File annotation Created: 18/Aug/10 Updated: 18/Aug/10 Resolved: 18/Aug/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Vladimir Razuvaev | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Not sure if it is ODM issue or some PHP Reflection issue, or I just don't getting something, but following test case won't save the file: /** @Document(db="tests", collection="files") */ class file { /** @Id */ protected $id; /** * @File * @var \MongoGridFSFile */ protected $file; function __construct($file) {$this->file = $file;} } $f = new file(__DIR__ . '/test.txt'); $dm->persist($f); $dm->flush(); The problem is in annotation @var \MongoGridFSFile. Without it file is saved properly. Also, if I remove "\" in front of MongoGridFSFile, file will be also saved properly. Weird thing. |
| Comments |
| Comment by Jonathan H. Wage [ 18/Aug/10 ] |
|
I think this is a problem with the annotations parser and nothing with the ODM. |
| Comment by Jonathan H. Wage [ 18/Aug/10 ] |
|
This was an issue with Doctrine Common. I committed a fix for it. |
[MODM-49] Getting PHP notice and warning with empty persistent collection Created: 17/Aug/10 Updated: 17/Aug/10 Resolved: 17/Aug/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Collections |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Vladimir Razuvaev | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
If there is an object with empty collection, e.g.: {
"_id": "4c6a11810f9d503c03000000",
"b": [
]
}
Then following code produces notice and warning: /** @Document(db="tests", collection="tests") */ class a { /** @Id */ protected $id; /** @ReferenceMany(targetDocument="b", cascade="persist") */ protected $b; function getB() {return $this->b;} } /** @Document(db="tests", collection="tests2") */ class b { /** @Id */ protected $id; } $a = $dm->loadByID('a', '4c6a11810f9d503c03000000'); echo count($a->getB()); // produces notice and warning Notice and warning text: Notice: Undefined variable: groupedIds in library\Doctrine\ODM\MongoDB\PersistentCollection.php on line 122
Warning: Invalid argument supplied for foreach() in library\Doctrine\ODM\MongoDB\PersistentCollection.php on line 122
|
| Comments |
| Comment by Jonathan H. Wage [ 17/Aug/10 ] |
|
This is fixed now. |
[MODM-50] GridFs file classes don't support inheritance Created: 17/Aug/10 Updated: 17/Aug/10 Resolved: 17/Aug/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Vladimir Razuvaev | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
GridFs files do not support inheritance anymore. This issue only appeared after latest updates from git. It was working before. Here is a test case: /** * @Document(collection="files", db="tests") * @InheritanceType("SINGLE_COLLECTION") * @DiscriminatorField(fieldName="type") * @DiscriminatorMap({ * "file"="file", * "image"="image" * }) */ class file { /** @Id */ protected $id; /** @File */ protected $file; function __construct($file) {$this->file = $file;} } /** @Document(collection="files", db="tests") */ class image extends file { /** @File */ protected $file; } $a = new image(__DIR__ . '/test.txt'); $dm->persist($a); $dm->flush(); This code creates document in regular collection "files" instead of GridFs collection. |
| Comments |
| Comment by Jonathan H. Wage [ 17/Aug/10 ] |
|
Thanks for the issue! Fixed by http://github.com/doctrine/mongodb-odm/commit/3830635986a288235c46e198b7170d959ce37647 |
| Comment by Vladimir Razuvaev [ 17/Aug/10 ] |
|
Thanks for quick fixes! I also found other weird issue, will create separate case for it. |
[MODM-47] @AlsoLoad annotation, used on method causes fatal error Created: 16/Aug/10 Updated: 17/Aug/10 Resolved: 17/Aug/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Vladimir Razuvaev | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Getting following errors when using @AlsoLoad annotation on method: Notice: Undefined index: isCascadePersist in library\Doctrine\ODM\MongoDB\UnitOfWork.php on line 1661 Notice: Undefined index: fieldName in library\Doctrine\ODM\MongoDB\UnitOfWork.php on line 362 Notice: Undefined index: in library\Doctrine\ODM\MongoDB\Mapping\ClassMetadata.php on line 923 Fatal error: Call to a member function getValue() on a non-object in library\Doctrine\ODM\MongoDB\Mapping\ClassMetadata.php on line 923 Test Case: /** @Document(db="tests", collection="tests") */ class a { /** @Id */ protected $id; /** @String */ protected $b = 'tmp'; /** @AlsoLoad("c") */ function renameC($c) {$this->b = $c;} function getId() {return $this->id;} } $a = new a(); $dm->persist($a); $dm->flush(); $dm->getUnitOfWork()->clear(); $a = $dm->loadByID('a', $a->getId()); |
| Comments |
| Comment by Jonathan H. Wage [ 17/Aug/10 ] |
|
Thanks for all the issues Fixed here http://github.com/doctrine/mongodb-odm/commit/6e7610ac99dcc4cab92cd01bd66e0a2c9ffda1ce |
[MODM-45] Doctrine doesn't persist empty objects Created: 16/Aug/10 Updated: 17/Aug/10 Resolved: 17/Aug/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Persister |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Vladimir Razuvaev | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Doctrine won't persist object if it is empty (all fields are nulls). Not sure if it is bug or expected behavior, but sometimes it causes inconvenience. Test case: /** @Document(db="tests", collection="tests") */ class a { /** @Id */ protected $id; /** @String */ protected $b; } $a = new a(); $dm->persist($a); $dm->flush(); // $a won't be inserted There is also related issue: when embedding empty object (all fields are nulls) embedded object is not saved. /** @Document(db="tests", collection="tests") */ class a { /** @Id */ protected $id; /** @String */ protected $tmp = 'WorkaroundToBeSaved'; /** @EmbedOne(targetDocument="b", cascade="all") */ protected $b; function getId() {return $this->id;} function getB() {return $this->b;} function setB($b) {$this->b = $b;} } /** @EmbeddedDocument */ class b { /** @String */ protected $val; function setVal($val) {$this->val = $val;} function getVal() {return $this->val;} } $a = new a(); $a->setB(new b()); $dm->persist($a); $dm->flush(); $dm->getUnitOfWork()->clear(); $a = $dm->loadByID('a', $a->getId()); $c = (null !== $a->getB()); var_dump($c); // returns false, while expecting true |
| Comments |
| Comment by Jonathan H. Wage [ 16/Aug/10 ] |
|
Mongo won't let you insert empty documents, so we can't allow it. |
| Comment by Jonathan H. Wage [ 16/Aug/10 ] |
$mongo = new Mongo();
$doc = array();
$mongo->dbname->coll->insert($doc);
Causes this error: PHP Fatal error: Uncaught exception 'MongoException' with message 'no elements in doc' in /Users/jwage/Sites/mongodb-odm/test.php:5
Stack trace:
#0 /Users/jwage/Sites/mongodb-odm/test.php(5): MongoCollection->insert(Array)
#1 {main}
thrown in /Users/jwage/Sites/mongodb-odm/test.php on line 5
MongoException: no elements in doc in /Users/jwage/Sites/mongodb-odm/test.php on line 5
Call Stack:
0.0004 320216 1. {main}() /Users/jwage/Sites/mongodb-odm/test.php:0
0.0037 322036 2. MongoCollection->insert() /Users/jwage/Sites/mongodb-odm/test.php:5
|
| Comment by Vladimir Razuvaev [ 16/Aug/10 ] |
|
I see now. But second case is still possible with mongo and not supported by ODM: $a = new a(); $a->setB(new b()); $dm->persist($a); $dm->flush($a); /* expecting: { "_id": "4c69ff3c0f9d50c80e000000", "tmp": "WorkaroundToBeSaved", "b" => [] } * getting: { "_id": "4c69ff3c0f9d50c80e000000", "tmp": "WorkaroundToBeSaved" } */ Also, if I remove string "WorkaroundToBeSaved" from $a, it won't be saved with flush, although it is not empty (has $b field set). |
| Comment by Jonathan H. Wage [ 17/Aug/10 ] |
|
This is expected as well since we never store null values or empty arrays. |
| Comment by Jonathan H. Wage [ 17/Aug/10 ] |
|
After a second look we can fix this. |
| Comment by Jonathan H. Wage [ 17/Aug/10 ] |
|
Fixed by http://github.com/doctrine/mongodb-odm/commit/b3a16496c0576e8f926faec9bbcfd5716006273b |
[MODM-46] @AlsoLoad annotation causes exception when used together with Embed/Reference annotations Created: 16/Aug/10 Updated: 17/Aug/10 Resolved: 17/Aug/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Vladimir Razuvaev | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Imagine that there is following object in DB: {
"_id": "4c6936bf0f9d50300d000000",
"c": {
"tmp": "tmp"
}
}
And I want to rename property "c" to "b" in my class, using @AlsoLoad together with @EmbedOne /** @Document(db="tests", collection="tests") */ class a { /** @Id */ protected $id; /** * @EmbedOne(targetDocument="b") * @AlsoLoad("c") */ protected $b; } /** @EmbeddedDocument */ class b { protected $tmp = 'tmp'; } $a = $dm->loadByID('a', '4c6936bf0f9d50300d000000'); // will throw an exception: Property "b" in "a" was already declared, but it must be declared only once |
| Comments |
| Comment by Jonathan H. Wage [ 17/Aug/10 ] |
|
Fixed by http://github.com/doctrine/mongodb-odm/commit/166ca49c13c8e3132b85383e4c55f0a09ce0d2b1 |
[MODM-48] Embedded document changes are ignored if it was empty before Created: 16/Aug/10 Updated: 17/Aug/10 Resolved: 17/Aug/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Persister |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Vladimir Razuvaev | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Imaging the object in DB: {
"_id": "4c693f9f0f9d501c0d000000",
"b": [
]
}
Then following code fails to update property "b": /** @Document(db="tests", collection="tests") */ class a { /** @Id */ protected $id; /** @EmbedOne(targetDocument="b", cascade="all") */ protected $b; function getId() {return $this->id;} function getB() {return $this->b;} function setB($b) {$this->b = $b;} } /** @EmbeddedDocument */ class b { /** @String */ protected $val; function setVal($val) {$this->val = $val;} function getVal() {return $this->val;} } $a = $dm->loadByID('a', '4c693f9f0f9d501c0d000000'); $a->getB()->setVal('test'); $dm->persist($a); $dm->flush(); $dm->getUnitOfWork()->clear(); $a = $dm->loadByID('a', $a->getId()); $c = ('test' === $a->getB()->getVal()); var_dump($c); // expecting "true", but outputs false |
| Comments |
| Comment by Jonathan H. Wage [ 16/Aug/10 ] |
|
Are you using the most recent version of mongo in git? |
| Comment by Vladimir Razuvaev [ 16/Aug/10 ] |
|
Yes, just updated to today's version from git - got same results. |
| Comment by Jonathan H. Wage [ 17/Aug/10 ] |
|
Thanks for the issue! Fixed by http://github.com/doctrine/mongodb-odm/commit/c57cc9fbf279918edcafd03ab4562ed33b467323 |
[MODM-44] repositoryClass doesn't always get picked up for the Document Annotation Created: 10/Aug/10 Updated: 17/Aug/10 Resolved: 17/Aug/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Document Manager |
| Affects Version/s: | 1.0.0BETA1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | D Ashwood | Assignee: | Jonathan H. Wage |
| Resolution: | Cannot Reproduce | Votes: | 0 |
| Labels: | None | ||
| Environment: |
SF2 |
||
| Description |
|
Adding the following to getRepository after the $customRepositoryClassName=.. die(print_r( array($customRepositoryClassName, $metadata),true));
Provides: Array ( [0] => [1] => Doctrine\ODM\MongoDB\Mapping\ClassMetadata Object ( [db] => default [collection] => User [identifier] => id [file] => [indexes] => Array ( ) [name] => Bundle\DoctrineUserBundle\Documents\User [namespace] => Bundle\DoctrineUserBundle\Documents [rootDocumentName] => Bundle\DoctrineUserBundle\Documents\User [customRepositoryClassName] => [allowCustomID] => [parentClasses] => Array ( ) [subClasses] => Array ( ) [reflFields] => Array ( [id] => ReflectionProperty Object ( [name] => id [class] => Bundle\DoctrineUserBundle\Documents\User ) ) [_prototype:Doctrine\ODM\MongoDB\Mapping\ClassMetadata:private] => [inheritanceType] => 1 [fieldMappings] => Array ( [id] => Array ( [id] => 1 [fieldName] => id [name] => id [isCascadeRemove] => [isCascadePersist] => [isCascadeRefresh] => [isCascadeMerge] => [isCascadeDetach] => [type] => id [nullable] => ) ) [lifecycleCallbacks] => Array ( ) [discriminatorValue] => [discriminatorMap] => Array ( ) [discriminatorField] => [reflClass] => ReflectionClass Object ( [name] => Bundle\DoctrineUserBundle\Documents\User ) [isMappedSuperclass] => [isEmbeddedDocument] => ) ) For the following Document: /** * @Document( * db="account", * collection="sf_doctrine_user", * indexes={ * @Index(keys={"username"="asc"}) * }, * repositoryClass="Bundle\UserBundle\Documents\UserRepository" * ) * @HasLifecycleCallbacks */ class User |
| Comments |
| Comment by D Ashwood [ 10/Aug/10 ] |
|
I suspect that it's due to the driver it's using - for some reason it wants to use the XMLDriver. |
| Comment by D Ashwood [ 10/Aug/10 ] |
|
Ok - I've tracked down this issue and it's related to the XMLDriver being used as the default driver with SF2, MongoBundle & Mongo-odm. It'll try to annotation driver correctly if you have a folder called \Document. It would be helpful if we could config the folder name. |
| Comment by Jonathan H. Wage [ 11/Aug/10 ] |
|
It works by detecting the files you have in your bundle. Do you have some .dcm.xml files in your bundle? |
| Comment by D Ashwood [ 12/Aug/10 ] |
|
Nope. They're all PHP files. |
| Comment by Jonathan H. Wage [ 17/Aug/10 ] |
|
I can't reproduce anything here. It sounds like it would be a Symfony2 issue and not something with the ODM itself. |
[MODM-42] PersistentCollection fails when working with MongoGridFs Created: 10/Aug/10 Updated: 17/Aug/10 Resolved: 17/Aug/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Collections |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Vladimir Razuvaev | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Getting following error when trying to use MongoGridFs files with referenceMany: Argument 2 passed to Doctrine\ODM\MongoDB\UnitOfWork::getOrCreateDocument() must be an array, object given, called in D:\Work\www\syter2.localhost.dev\library\Doctrine\ODM\MongoDB\PersistentCollection.php on line 110 and defined D:\Work\www\syter2.localhost.dev\library\Doctrine\ODM\MongoDB\UnitOfWork.php:1719 As far as I understand queries against MongoGridFS collection return instances of MongoGridFSFile, while PersistentCollection only expects arrays (as with regular collections) I think Issue appeared after latest updates from git. Because I didn't experience it with ALPHA1 (didn't test with ALPHA2) |
| Comments |
| Comment by Jonathan H. Wage [ 10/Aug/10 ] |
|
I'll check it out, if you can provide a test that'd be helpful. |
| Comment by Vladimir Razuvaev [ 10/Aug/10 ] |
|
Here is a test case: /** @Document(db="tests", collection="tests") */ class a { /** @Id */ protected $id; /** @ReferenceMany(targetDocument="file") */ protected $files = array(); function __construct($files) {$this->files = $files;} function getFiles() {return $this->files;} } /** @Document(db="tests", collection="files") */ class file { /** @Id */ protected $id; /** @File */ protected $file; function __construct($path) {$this->file = $path;} function getMongoFile() {return $this->file;} } $f = new file(__DIR__ . '/test.txt'); $a = new a(array($f)); $dm->persist($f); $dm->persist($a); $dm->flush(); $dm->getUnitOfWork()->clear(); $a = $dm->findOne('a', array()); foreach($a->getFiles() as $file) { $file->getMongoFile(); // produces catchable fatal error } |
| Comment by Jonathan H. Wage [ 10/Aug/10 ] |
|
Fixed in http://github.com/doctrine/mongodb-odm/commit/964ce247841d11af8ab28cfbde36f6cc09b0d366 |
[MODM-43] Explicit schema migration Created: 10/Aug/10 Updated: 17/Aug/10 Resolved: 17/Aug/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Hydration |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA1 |
| Type: | New Feature | Priority: | Major |
| Reporter: | Vladimir Razuvaev | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Currently supported ways of schema migration are sufficient in many cases. But I think it's worth considering to have more explicit way to migrate schema for better readability / code maintenance. It might be useful to be able to transform original MongoDb data prior to hydration. Maybe as a new lifecycle callback (e.g. preLoad). This way one could have special property for schema version in the document and normalize data according to version differencies. e.g.: function preLoad(array &$data)
{
if(!isset($data['version'])) {
$data['version'] = 1;
}
switch($data['version']) {
case 1:
$data['fullName'] = $data['name'];
unset($data['name']);
// breaks are ommitted intentionally here and below
case 2:
$e = explode(' ', $data['fullName'])
$data['firstname'] = $e[0];
$data['lastname'] = $e[1];
unset($data['fullName']);
case 3:
$data['address'] = array(
'street' => $data['street'],
'city' => $data['city']
);
unset($data['street']);
unset($data['city']);
case 4:
default:
// current version
}
}
Just as example. It also simplifies writing tests for schema migrations as I think. Is it possible with current ODM internals? What do you think? |
| Comments |
| Comment by Jonathan H. Wage [ 10/Aug/10 ] |
|
I think this can be implemented already without having to change Doctrine. You just need to manage a version field and use the preLoad() like you are above. It is an acceptable idea, but I think it is already possible. What do you think? |
| Comment by Vladimir Razuvaev [ 11/Aug/10 ] |
|
It's great if it is already possible. But I think there is no "preLoad", "preHydrate" or similar event right now. At least I didn't find one in code or docs. |
| Comment by Jonathan H. Wage [ 11/Aug/10 ] |
|
Ok, I think maybe we can add a preLoad() event. |
| Comment by Jonathan H. Wage [ 17/Aug/10 ] |
|
Fixed by http://github.com/doctrine/mongodb-odm/commit/78fefc3b70aa8ec0facd3cc4ffa27d6c88670407 |
[MODM-40] Move value scalarization and comparison to Unit Of Work Created: 06/Aug/10 Updated: 06/Aug/10 Resolved: 06/Aug/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Persister, UnitOfWork |
| Affects Version/s: | 1.0.0ALPHA1, 1.0.0ALPHA2 |
| Fix Version/s: | 1.0.0BETA1 |
| Type: | Task | Priority: | Major |
| Reporter: | Bulat Shakirzyanov | Assignee: | Bulat Shakirzyanov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
The BasicDocumentPersister::_equals belongs in the UnitOfWork. |
| Comments |
| Comment by Jonathan H. Wage [ 06/Aug/10 ] |
|
I refactored and that code is not needed and gone now. |
[MODM-41] Hydration down not work for annotation "@ReferenceMany" Created: 06/Aug/10 Updated: 09/Aug/10 Resolved: 06/Aug/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Hydration |
| Affects Version/s: | 1.0.0ALPHA2 |
| Fix Version/s: | 1.0.0BETA1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Flavio Lacerda | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Windows(webserver) / Unix (Mongo) |
||
| Attachments: |
|
| Description |
|
When you try to find or execute query, filds with annotation reference many (arrays) do not load. Example: user.php <?php /** * @Document(db="DB", collection="Users") */ class User { /** * @Id */ public $id; /** * @String */ public $name; /** * @String */ public $password; /** * @String */ public $email; /** * @ReferenceMany(targetDocument="Group") */ public $groups = array(); } ?> group.php <?php /** * @Document(db="MCI", collection="Groups") */ class Group { /** * @Id */ public $id; /** * @String */ public $name; /** * @String */ public $role_name; } ?> When you execute this line: $obj = $this->dm->findOne("User",("name" => "Flavio")); All the fields are returned correctly, but "groups" apear empty. When you use @EmbedMany annotation works file. Regards. PS: I'm using codeigniter framework |
| Comments |
| Comment by Jonathan H. Wage [ 06/Aug/10 ] |
|
This works for me. Can you provide a more exact test case that does not work? |
| Comment by Flavio Lacerda [ 06/Aug/10 ] |
|
I created an script. |
| Comment by Jonathan H. Wage [ 06/Aug/10 ] |
|
http://github.com/doctrine/mongodb-odm/commit/cbe22dfd50225250ab468ea2f5e243736b2f35fd |
| Comment by Flavio Lacerda [ 09/Aug/10 ] |
|
Now works perfect. I´m using it a lot. Amazing lib and amazing support. |
[MODM-38] Using YAML description with embedMany causes PHP notice error Created: 04/Aug/10 Updated: 06/Aug/10 Resolved: 06/Aug/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | 1.0.0ALPHA2 |
| Fix Version/s: | 1.0.0BETA1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Sebastian Hoitz | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
When using the YAML style description together with the new embedMany functionality of mixed documents, you get a PHP notice error every time you create a new model. Because when you have mixed documents, you don't specify a targetDocument, and therefore the YAML Driver can not find an element in the array that describes the targetDocument. |
| Comments |
| Comment by Jonathan H. Wage [ 06/Aug/10 ] |
|
http://github.com/doctrine/mongodb-odm/commit/8c8437a9113a0849f38db0664f66dd407a497918 |
[MODM-35] Proxy item gets reset on persistent collection load if that item was in the collection Created: 02/Aug/10 Updated: 06/Aug/10 Resolved: 06/Aug/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | 1.0.0ALPHA2 |
| Fix Version/s: | 1.0.0BETA1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Bulat Shakirzyanov | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Comments |
| Comment by Jonathan H. Wage [ 06/Aug/10 ] |
|
http://github.com/doctrine/mongodb-odm/commit/236d4c6fad228f281a6fff9979c5fdc3773969e1 |
[MODM-34] Custom Id always gets sent with changeset Created: 02/Aug/10 Updated: 06/Aug/10 Resolved: 06/Aug/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | UnitOfWork |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Bulat Shakirzyanov | Assignee: | Bulat Shakirzyanov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Whenever the Unit of Work computes the changeset for a document with custom id, the id attribute always gets sent. |
| Comments |
| Comment by Jonathan H. Wage [ 06/Aug/10 ] |
|
http://github.com/doctrine/mongodb-odm/commit/ad8a7821bd176e875b9ec1f756c32a15eed31fb3 |
[MODM-33] Class-level annotations are ignored if set on MappedSuperclass Created: 02/Aug/10 Updated: 06/Aug/10 Resolved: 06/Aug/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Vladimir Razuvaev | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Class-level annotations: @HasLifecycleCallbacks, @InheritanceType, @DiscriminatorField, @DiscriminatorMap have no effect when defined on @MappedSuperclass You must explicitly set @HasLifecycleCallbacks for every document class to make callback work. As for inheritance annotations, you have to copy-paste all annotations to all document classes to make it work. Simple example: /** * @MappedSuperclass * @HasLifecycleCallbacks */ abstract class a { /** @String */ protected $a = ''; /** @PrePersist */ function prePersist() {$this->a = 'a';} } /** @Document(db="tests",collection="tests") */ class b extends a {} $b = new b(); $dm->persist($b); $dm->flush($b); With this example prePersist won't be called. Not sure if it is bug or expected behavior, but it adds some inconvenience, especially with inheritance mapping. |
| Comments |
| Comment by Jonathan H. Wage [ 02/Aug/10 ] |
|
This appears to work for me. I tested it here http://github.com/doctrine/mongodb-odm/commit/af9aa0f674f8b542c89f8c975ac403fd46f6e29e |
| Comment by Vladimir Razuvaev [ 02/Aug/10 ] |
|
Hi, looks like it affected ALPHA1. Also, want to thank you and other committers for ODM project. It is really cool! |
| Comment by Vladimir Razuvaev [ 05/Aug/10 ] |
|
Looks like issue still exists for inheritance. At least following test case doesn't work for me on the latest version from git: /** * @MappedSuperClass * @InheritanceType("SINGLE_COLLECTION") * @DiscriminatorField(fieldName="type") * @DiscriminatorMap({ * "b"="b", * "c"="c" * }) */ abstract class a { /** @String */ protected $a = ''; } /** @Document(db="tests",collection="tests") */ class b extends a {} /** @Document(db="tests",collection="tests") */ class c extends a {} $b = new b(); $dm->persist($b); $dm->flush($b); New document will be created without "type" field. It works properly only if I copy-paste all annotations to every document class (b, c, etc). |
| Comment by Jonathan H. Wage [ 05/Aug/10 ] |
|
I don't think that is supposed to work. Try removing the @MappedSuperclass annotation. |
| Comment by Vladimir Razuvaev [ 05/Aug/10 ] |
|
Removing @MappedSuperClass didn't help, but adding @Document annotation on abstract class did (it also allows to remove @Document annotation on concrete classes). The main point was to avoid annotations duplication, so I think this solution works pretty well. But maybe worth mentioning in the documentation, because it is pretty common use case to have one abstract class and several subclasses within same collection. And it took some time for me to find out how that could be done. |
| Comment by Jonathan H. Wage [ 06/Aug/10 ] |
|
Pretty sure it is fixed now. http://github.com/doctrine/mongodb-odm/commit/7ca29f25f7018b781183cf72082802ab4dcc567a |
[MODM-37] Problems with EmbedMany and discrimatorMap and discriminatorField Created: 04/Aug/10 Updated: 06/Aug/10 Resolved: 06/Aug/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | 1.0.0ALPHA1 |
| Fix Version/s: | 1.0.0BETA1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Sebastian Hoitz | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
I'm experiencing a problem when trying to embed documents and specify my own discriminatorMap and Field. This is the code I have: /** @Document(collection = "ticket") */ class App_Model_Ticket extends App_Model_Abstract { /** * @EmbedMany( * discriminatorField = "type", * discriminatorMap={ * "twitter"="App_Model_Ticket_Twitter", * "email"="App_Model_Ticket_Email" * }) */ protected $messages = array(); // [...] } App_Model_Abstract is a MappedSuperClass. App_Model_Ticket_Email and App_Model_Ticket_Twitter pretty much look alike right now: /** @EmbeddedDocument */
class App_Model_Ticket_Email extends App_Model_Ticket_Message
{
}
and App_Model_Ticket_Message is another MappedSuperClass that extends App_Model_Abstract. Now, whenever I create a new model and persist it to mongoDB, the entry gets created and looks like this: [_id] => MongoId Object ( ) [messages] => Array ( [0] => Array ( [message] => Lorem ipsum [subject] => Ich bin ein Berliner22 [dateSent] => MongoDate Object ( [sec] => 1280909855 [usec] => 0 ) [_doctrine_class_name] => App_Model_Ticket_Twitter ) [1] => Array ( [message] => Lorem ipsum [subject] => Ich bin ein Berliner22 [dateSent] => MongoDate Object ( [sec] => 1280909855 [usec] => 0 ) [_doctrine_class_name] => App_Model_Ticket_Email ) ) [subject] => Ich bin ein Berliner22 [dateCreated] => MongoDate Object ( [sec] => 1280909855 [usec] => 0 ) [dateLastMessage] => MongoDate Object ( [sec] => 1280909855 However, as you can see no type field for my embedded documents, it still uses _doctrine_class_name. But when I try to fetch this object, I get an exception saying "Class not found". I think this is because right now Doctrine ODM does not write into the custom discriminatorField with embedded documents, but reads from it. |
| Comments |
| Comment by Jonathan H. Wage [ 06/Aug/10 ] |
|
http://github.com/doctrine/mongodb-odm/commit/618896bb8d879a8365dc359a8949c9d2cad5bec7 |
[MODM-32] dbref $id persisted as string instead of objectid Created: 31/Jul/10 Updated: 06/Aug/10 Resolved: 06/Aug/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Persister |
| Affects Version/s: | 1.0.0ALPHA1, 1.0.0ALPHA2, 1.0.0BETA1 |
| Fix Version/s: | 1.0.0BETA1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Bulat Shakirzyanov | Assignee: | Bulat Shakirzyanov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
A clone of http://github.com/doctrine/mongodb-odm/issues/issue/2/. |
| Comments |
| Comment by Jonathan H. Wage [ 06/Aug/10 ] |
|
http://github.com/doctrine/mongodb-odm/commit/935759b498a057d08652379fb8133bb238b23a18 |
[MODM-36] Embedded relations are not persisted after a flush() Created: 03/Aug/10 Updated: 06/Aug/10 Resolved: 06/Aug/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Pablo Godel | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
Newly added embedded relations do not get persisted when a flush() is executed before they are added to the parent document. Here is a failing test, note the comment "// Adding this flush here makes level1 not to be inserted.": public function testFlushEmbedded() { $test = new EmbeddedTestLevel0(); $test->name = 'test'; $this->dm->persist($test); $this->dm->flush(); $this->dm->clear(); $test = $this->dm->findOne('Documents\Functional\EmbeddedTestLevel0'); $this->assertInstanceOf('Documents\Functional\EmbeddedTestLevel0', $test); // Adding this flush here makes level1 not to be inserted. $this->dm->flush(); $level1 = new EmbeddedTestLevel1(); $level1->name = 'test level1 #1'; $test->level1[] = $level1; $this->dm->persist($test); $this->dm->flush(); $this->dm->clear(); $test = $this->dm->findOne('Documents\Functional\EmbeddedTestLevel0'); $this->assertInstanceOf('Documents\Functional\EmbeddedTestLevel0', $test); $this->assertInstanceOf('Documents\Functional\EmbeddedTestLevel1', $test->level1[0]); } |
| Comments |
| Comment by Vladimir Razuvaev [ 06/Aug/10 ] |
|
I also experience this issue. Formatted text from original message for convenience: public function testFlushEmbedded() { $test = new EmbeddedTestLevel0(); $test->name = 'test'; $this->dm->persist($test); $this->dm->flush(); $this->dm->clear(); $test = $this->dm->findOne('Documents\Functional\EmbeddedTestLevel0'); $this->assertInstanceOf('Documents\Functional\EmbeddedTestLevel0', $test); // Adding this flush here makes level1 not to be inserted. $this->dm->flush(); $level1 = new EmbeddedTestLevel1(); $level1->name = 'test level1 #1'; $test->level1[] = $level1; $this->dm->persist($test); $this->dm->flush(); $this->dm->clear(); $test = $this->dm->findOne('Documents\Functional\EmbeddedTestLevel0'); $this->assertInstanceOf('Documents\Functional\EmbeddedTestLevel0', $test); $this->assertInstanceOf('Documents\Functional\EmbeddedTestLevel1', $test->level1[0]); } |
| Comment by Jonathan H. Wage [ 06/Aug/10 ] |
|
Do you all have the cascade operating enabled in your mapping? |
| Comment by Jonathan H. Wage [ 06/Aug/10 ] |
|
Fixed in http://github.com/doctrine/mongodb-odm/commit/20033a35a9cbf345636defdaaaa57204bae8fbab |
[MODM-28] xml mapping : embedded-document node is ignored, can't persist Created: 26/Jul/10 Updated: 27/Jul/10 Resolved: 27/Jul/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | 1.0.0ALPHA1 |
| Fix Version/s: | 1.0.0ALPHA2 |
| Type: | Bug | Priority: | Major |
| Reporter: | julien rollin | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
//file Doctrine/ODM/MongoDB/Mapping/Driver/XmlDriver.php line 171 protected function _loadMappingFile($file) { $result = array(); $xmlElement = simplexml_load_file($file); if (isset($xmlElement->document)) { foreach ($xmlElement->document as $documentElement) { $documentName = (string) $documentElement['name']; $result[$documentName] = $documentElement; } } return $result; } embedded-document and mapped-superclass are ignored so embed documents are not persisted |
[MODM-30] yaml lifecycleCallbacks param expects an array not string Created: 27/Jul/10 Updated: 27/Jul/10 Resolved: 27/Jul/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | 1.0.0ALPHA1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | julien rollin | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
In the manual, when configuring lifecycleCallbacks lifecycleCallbacks:
doStuffOnPrePersist: prePersist
doStuffOnPostPersist: postPersist
it seems, that event name must be the key not the value lifecycleCallbacks:
prePersist: doStuffOnPrePersist
postPersist: doStuffOnPostPersist
and when parsing it is expecting an array not a string maybe a fix would be : // Doctrine/ODM/MongoDB/Mapping/Driver/YamlDriver.php line 123 if (isset($element['lifecycleCallbacks'])) { foreach ($element['lifecycleCallbacks'] as $type => $methods) { if(!is_array($methods)){ $methods = array($methods); } foreach ($methods as $method) { $class->addLifecycleCallback($method, constant('Doctrine\ODM\MongoDB\ODMEvents::' . $type)); } } } |
| Comments |
| Comment by Jonathan H. Wage [ 27/Jul/10 ] |
|
Hi, where in the documentation do you see that example? |
| Comment by Jonathan H. Wage [ 27/Jul/10 ] |
|
I fixed the issue in the code but I can't locate the example documentation you are pasting to fix. |
| Comment by Jonathan H. Wage [ 27/Jul/10 ] |
|
Actually, I changed my mind. It will always require an array and we'll fix any wrong documentation. So this would be correct: lifecycleCallbacks:
prePersist: [doStuffOnPrePersist]
postPersist: [doStuffOnPostPersist]
|
| Comment by julien rollin [ 27/Jul/10 ] |
|
Hi, |
[MODM-29] Persisting changes ordering of elements in embedded collection in some cases Created: 27/Jul/10 Updated: 19/Aug/10 Resolved: 18/Aug/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Persister |
| Affects Version/s: | 1.0.0ALPHA2 |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Vladimir Razuvaev | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
After changing ordering of elements in collection, it is persisted incorrectly (with different ordering than expected). Here is a test case: /** @Document(collection="tests", db="tests") */ class doc { /** @Id */ protected $id; /** @EmbedMany(targetDocument="emb") */ protected $collection; function __construct($c) {$this->set($c);} function set($c) {$this->collection = $c;} function get() {return $this->collection;} } /** @EmbeddedDocument */ class emb { /** @String */ protected $val; function __construct($val) {$this->val = $val;} function get() {return $this->val;} } $collection = new ArrayCollection(array( new emb('0'), new emb('1'), new emb('2') )); // TEST CASE: $doc = new doc($collection); $dm->persist($doc); $dm->flush(); // place element '0' after '1' $collection = new ArrayCollection(array( $collection[1], $collection[0], $collection[2] )); $doc->set($collection); $dm->persist($doc); $dm->flush(); $dm->refresh($doc); foreach($doc->get() as $value) { echo $value->get() . "\n"; } // expecting: // 1 // 0 // 2 // getting: // 2 // 1 // 0 Is it an issue? Or is it supposed that ordering should be resolved in application code? |
| Comments |
| Comment by Jonathan H. Wage [ 27/Jul/10 ] |
|
Hi, I think we should try and make it maintain the order. I will investigate. |
| Comment by Jonathan H. Wage [ 27/Jul/10 ] |
|
I am not sure if we can control the order. Mongo doesn't give us anyway to do this. We use $pullAll and $pushAll operators currently. Can you log that test and paste what queries are executed on mongo when persisting? |
| Comment by Bulat Shakirzyanov [ 27/Jul/10 ] |
|
I think that you should be getting 2,1,0 after the first flush as well, since we would not send an update after the second flush at all. We check whether the actual value in the collection changed or not, if you want the keys to be taken into account, you should use @Hash instead. |
| Comment by Vladimir Razuvaev [ 28/Jul/10 ] |
|
I have just checked. After first flush I get expected result: 0, 1, 2. And for second flush Doctrine Persister generates following update query: Array
(
[$pullAll] => Array
(
[collection] => Array
(
[0] => Array
(
[val] => 0
)
[1] => Array
(
[val] => 1
)
)
)
[$pushAll] => Array
(
[collection] => Array
(
[0] => Array
(
[val] => 1
)
[1] => Array
(
[val] => 0
)
)
)
)
Then it sequentally executes two updates: 1 for $pullAll and then another for $pushAll (due to http://jira.mongodb.org/browse/SERVER-1050). As a result 1, 0 are pushed after 2 and we get 2,1,0. I think in many cases using $set would work as a workaround for this issue. But as far as I understand there is no way to hint Doctrine to use $set currently. Or is it possible somehow? Hash won't work in this case, because it doesn't preserve classes of embedded objects. |
| Comment by Jonathan H. Wage [ 30/Jul/10 ] |
|
I think we can maybe allow you to force a collection to always use $set if you want to maintain ordering. The downside is it is much slower and not atomic. I don't know if it is a good idea, what do you think? |
| Comment by Vladimir Razuvaev [ 31/Jul/10 ] |
|
Well, in my use case $set will work well, because embedded objects are small, there will be only 1-40 of them and saving operation is rare. I think this use-case is pretty usual, so $set will be definately useful. The alternative is to complicate application-code to resolve ordering on the client-side, which doesn't worth it in many cases. And people will use different workarounds as I did: currently I update all embedded objects with unique random token and Doctrine pulls/pushes them all back with valid ordering. |
| Comment by Jonathan H. Wage [ 07/Aug/10 ] |
|
In this commit http://github.com/doctrine/mongodb-odm/commit/7a9e0088153e1f3f7f9a0650f5f7461bbc41ec64 I made it so that you can control the strategy for persisting. The default value is pushPull but you can also specify set so the entire value is re $set each time: /** @Collection(strategy="set") */ /** @ReferenceMany(strategy="set") */ /** @EmbedMany(strategy="set") */ |
| Comment by Vladimir Razuvaev [ 17/Aug/10 ] |
|
Discovered another related issue. There are situations with strategy "set", when ODM generates following update query: array (
'$set' => array (
'collection.1.val' => 'tmp',
'collection' => array (
0 => array (
'val' => '1',
),
1 => array (
'val' => 'tmp',
),
2 => array (
'val' => '2',
),
),
),
)
E.g. when changing ordering of elements AND field value of any embedded document. Full Test Case: /** @Document(collection="tests", db="tests") */ class doc { /** @Id */ protected $id; /** @EmbedMany(targetDocument="emb", strategy="set", cascade="all") */ protected $collection; /** @String */ protected $tmp = ''; // force save function __construct($c) {$this->set($c);} function getId() {return $this->id;} function set($c) {$this->collection = $c;} function get() {return $this->collection;} } /** @EmbeddedDocument */ class emb { /** @String */ protected $val; function __construct($val) {$this->set($val);} function get() {return $this->val;} function set($val) {$this->val = $val;} } $collection = new ArrayCollection(array( new emb('0'), new emb('1'), new emb('2') )); // TEST CASE: $doc = new doc($collection); $dm->persist($doc); $dm->flush(); // place element '0' after '1' $collection = new ArrayCollection(array( $collection[1], $collection[0], $collection[2] )); $doc->set($collection); // changing value together with reordering causes issue when saving: $collection[1]->set('tmp'); $dm->persist($doc); $dm->flush(); $dm->refresh($doc); foreach($doc->get() as $value) { echo $value->get() . "\n"; } // expecting: // 1 // 0 // 2 // getting: // 0 // 1 // 2 |
| Comment by Vladimir Razuvaev [ 18/Aug/10 ] |
|
Reopening because of other related issue |
| Comment by Jonathan H. Wage [ 18/Aug/10 ] |
|
So the "'collection.1.val' => 'tmp'," part succeeds and the rest is ignored? Obviously the 'collection.1.val' => 'tmp', part should not be there. |
| Comment by Jonathan H. Wage [ 18/Aug/10 ] |
|
Hi, to make things easier would you mind making the test cases in the Doctrine test suite? Every test case you provide is great and it works but I have to spend a few minutes modifying the code and putting it into a test case in phpunit. |
| Comment by Jonathan H. Wage [ 18/Aug/10 ] |
|
Why are you expecting 1, 0, 2? Wouldn't the change to 'tmp' need to be persisted as well? |
| Comment by Jonathan H. Wage [ 18/Aug/10 ] |
|
Fixed here http://github.com/doctrine/mongodb-odm/commit/485fbdfb7f85ecb290530ea0fc9c55a6dca91e19 I think the expected values and order would be "1, tmp, 2" |
| Comment by Vladimir Razuvaev [ 19/Aug/10 ] |
|
Yeah, sorry, expecting "1, tmp, 2" of course. As for tests - I'll setup Doctrine tests on my side. How should I deliver test cases then? Via github? Or just copy-paste phpunit tests here? |
[MODM-27] It would be great to have a way to use different collection classes with referencing/embedding Created: 22/Jul/10 Updated: 22/Jul/10 Resolved: 22/Jul/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Hydration |
| Affects Version/s: | 1.0.0ALPHA1 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major |
| Reporter: | Vladimir Razuvaev | Assignee: | Jonathan H. Wage |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Currently ODM creates an instance of ArrayCollection for every referenced/embedded collection. It would be great, if there was a way to specify which collection class should be actually used. Imagine simple use-case: one have created class TagsCollection extends ArrayCollection with __toString method, which automatically transforms collection of tags to comma-separated tags string. Would it be possible to have e.g. @EmbedMany(collection="TagsCollection") ? |
| Comments |
| Comment by Jonathan H. Wage [ 22/Jul/10 ] |
|
Is it not just as simple for you to do this yourself instead of cluttering the Doctrine codebase? Simply wrap your collection with your own class. Use another class to do what you want, passing the collection to it. |
| Comment by Jonathan H. Wage [ 22/Jul/10 ] |
|
Also, doing this I think would not be a good idea as it's not really related to object domain persistence. I think you should do this in your own project by wrapping collections or having a convenience/helper method you can pass a collection of tags to, to get the comma separated tags string. I also think this is not a part of your domain model, it is more a part of your view layer. |
| Comment by Vladimir Razuvaev [ 22/Jul/10 ] |
|
Well, that was just a simple example, I am pretty sure there might be other use-cases (related to domain model). Anyway if that is not an easy change, I'll use ArrayCollection here. Thanks for clarifications. |
[MODM-26] MongoCursor doesn't implement Countable interface Created: 13/Jul/10 Updated: 19/Jul/10 Resolved: 19/Jul/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | 1.0.0ALPHA1 |
| Fix Version/s: | 1.0.0ALPHA2 |
| Type: | Improvement | Priority: | Major |
| Reporter: | Bulat Shakirzyanov | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
this causes confusion when query returns empty array instead of MongoCursor object, meaning you can't use neither count($result) nor $result->count(), and have to check for the returned type explicitly |
| Comments |
| Comment by Jonathan H. Wage [ 19/Jul/10 ] |
|
Fixed and added a MongoCursorTest file. |
[MODM-25] AnnotationDriver.php Line 175 Created: 07/Jul/10 Updated: 19/Jul/10 Resolved: 19/Jul/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | 1.0.0ALPHA1 |
| Fix Version/s: | 1.0.0ALPHA2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Bulat Shakirzyanov | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
$mapping['fieldName'] should be replace with something else. |
[MODM-22] Document incorrectly scheduled for update Created: 28/Jun/10 Updated: 19/Jul/10 Resolved: 19/Jul/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Document Manager |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0ALPHA2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Steven Surowiec | Assignee: | Jonathan H. Wage |
| Resolution: | Cannot Reproduce | Votes: | 0 |
| Labels: | None | ||
| Description |
|
I have the following documents: Product: Sellable: Seller: If I create a new Sellable for a seller the seller gets scheduled for update even if nothing has changed.The document persister correctly doesn't try to actually execute the update but Lifecycle events still get called. The flow is: 1. Schedule for update preUpdate and postUpdate being called when there's no actual changes is causing problems. It seems like the proper course of action would be to either not schedule the document for update or check if there's any actual changes before calling preUpdate and postUpdate. |
| Comments |
| Comment by Jonathan H. Wage [ 05/Jul/10 ] |
|
I will take a look at this. Can you try creating a test case that reproduces the issue? |
| Comment by Jonathan H. Wage [ 13/Jul/10 ] |
|
Bulat, is this not fixed? |
| Comment by Jonathan H. Wage [ 19/Jul/10 ] |
|
Any chance of a test case? Could you provide the documents you are using? |
[MODM-16] loadById failing on custom ids Created: 17/Jun/10 Updated: 17/Jun/10 Resolved: 17/Jun/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0ALPHA2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Steven Surowiec | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
DocumentManager::loadByID is failing on custom ids right now because it's checking for the custom id flag on the metadata and converting to \MongoID. It should probably be using the new $class->getPHPIdentifierValue method instead. |
| Comments |
| Comment by Steven Surowiec [ 17/Jun/10 ] |
|
Fixed in http://github.com/opensky/mongodb-odm/commit/78ac8bf8e31e91f88d2cdd7918db3ebaafe76a63 |
| Comment by Jonathan H. Wage [ 17/Jun/10 ] |
|
Thanks for the issue and fix! |
[MODM-17] Multiple array / object with same content/properties do not get persisted Created: 17/Jun/10 Updated: 19/Jul/10 Resolved: 19/Jul/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0ALPHA2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Pablo Godel | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
If I have a Collection field and try to add 2 values that are the same, the second value never gets saved to the document. Example code: class User
{
/** @Id */
private $id;
/** @String */
private $name;
/** @Collection */
private $logs = array();
}
$o = $dm->findOne(':User', array('name' => $arguments['name']));
$found = true;
if (!$o) {
$found = false;
$o = new User();
}
$o->setName($arguments['name']);
$o->addLog( array('a' => 'b' ));
$dm->persist($o);
$dm->flush();
or a EmbeddedMany field, and try to add to add 2 objects with the same content the same thing happens: class User
{
/** @Id */
private $id;
/** @String */
private $name;
/** @EmbedMany(targetDocument="UserLog") */
private $logs = array();
}
$o = $dm->findOne(':User', array('name' => $arguments['name']));
$found = true;
if (!$o) {
$found = false;
$o = new User();
}
$o->setName($arguments['name']);
$l = new UserLog();
$l->setMsg('Testing');
$o->addLog($l);
$dm->persist($o);
$dm->flush();
If I change $l->setMsg('Testing'.time()); then it adds all the instances. |
| Comments |
| Comment by Jonathan H. Wage [ 19/Jul/10 ] |
|
Seems to be working now. |
[MODM-15] addWhere Created: 15/Jun/10 Updated: 15/Jun/10 Resolved: 15/Jun/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | 1.0.0ALPHA2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Florian Kubis | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
After removing addWhere http://www.doctrine-project.org/projects/mongodb_odm/1.0/docs/reference/query-builder-api/en#addWhere should be updated. http://github.com/doctrine/mongodb-odm/blob/master/lib/Doctrine/ODM/MongoDB/Query.php#L313 Thanks for the great work! |
[MODM-12] Undefined variable error Created: 09/Jun/10 Updated: 09/Jun/10 Resolved: 09/Jun/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | 1.0.0ALPHA1 |
| Fix Version/s: | 1.0.0ALPHA2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Steven Surowiec | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
In UnitOfWork::_computeAssociationChanges there are several references to $document but $document is never declared in that method, or passed into it. From looking at ORM it looks like $entry is the right variable to be using here. |
| Comments |
| Comment by Steven Surowiec [ 09/Jun/10 ] |
[MODM-13] Problems with merge() Created: 10/Jun/10 Updated: 10/Jun/10 Resolved: 10/Jun/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | 1.0.0ALPHA1 |
| Fix Version/s: | 1.0.0ALPHA2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Florian Kubis | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
OSX, HEAD |
||
| Description |
|
while doing a merge, I got some PHP errors. 2. in function _cascadeMerge starting in line 1464 of UnitOfWork.php I didn't look deeper into ODM, just tried this to things and it seems to work now, so please excuse if it's bs ... |
| Comments |
| Comment by Jonathan H. Wage [ 10/Jun/10 ] |
|
Thanks for reporting the issue! |
[MODM-11] Allow custom persisters Created: 07/Jun/10 Updated: 09/Jun/10 Resolved: 09/Jun/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major |
| Reporter: | Steven Surowiec | Assignee: | Jonathan H. Wage |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Description |
|
I'm trying to write a SoftDelete extension for Doctrine ODM but am unable to do so because I need to be able to either use my own, custom, Persister or my own, custom, MongoCollection proxy. Providing a custom persister seems like the way to go as it opens up the flexibility of creating other behaviors (such as a Paginator). |
| Comments |
| Comment by Steven Surowiec [ 07/Jun/10 ] |
|
Started in: http://github.com/opensky/mongodb-odm/tree/topic-MODM-11 |
| Comment by Jonathan H. Wage [ 07/Jun/10 ] |
|
I am not convinced this is a good idea. We need to think through this thoroughly before adding features like this. |
| Comment by Jonathan H. Wage [ 08/Jun/10 ] |
|
I think we need to allow custom ids that are not MongoId but I am not convinced allowing custom persisters is the right solution for you to create these extensions. We should see how this is best handled in the ORM and follow suit. |
[MODM-10] Missing use statement in UnitOfWork Created: 05/Jun/10 Updated: 09/Jun/10 Resolved: 06/Jun/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | 1.0.0ALPHA1 |
| Fix Version/s: | 1.0.0ALPHA1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Steven Surowiec | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
The UnitOfWork.php class has several references to LifecycleEventArgs but has no 'use' statement for it. This causes syntax errors when trying to use lifecycle events. |
| Comments |
| Comment by Steven Surowiec [ 05/Jun/10 ] |
|
Fixed in the below commit: http://github.com/opensky/mongodb-odm/commit/865527aa3403a1fd9f8acdddd0584e1b1e74438a |
| Comment by Jonathan H. Wage [ 06/Jun/10 ] |
|
Thanks for the issue and topic branch! Merged! |
[MODM-72] New property 'options' in Annotations Created: 06/Sep/10 Updated: 24/Nov/10 Resolved: 24/Nov/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | 1.0.0BETA1 |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | New Feature | Priority: | Minor |
| Reporter: | Stefan Riehl | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
It would be great for many purposes to add a property options to document annotations like this: /** @Field(type="mytype", options={}) */ the options should also be implemented in the MetadataClass. See also discussion: |
| Comments |
| Comment by Jonathan H. Wage [ 24/Nov/10 ] |
|
Fixed here https://github.com/doctrine/mongodb-odm/commit/16e0ac113c557c1fb73e3f31eec93176ad5992a1 |
[MODM-71] "Getting Started" Canonical example is needlessly confusing Created: 02/Sep/10 Updated: 03/Sep/10 Resolved: 02/Sep/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | 1.0.0BETA1 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Minor |
| Reporter: | cainiac | Assignee: | Jonathan H. Wage |
| Resolution: | Invalid | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Ubuntu 10.04 |
||
| Description |
|
http://www.doctrine-project.org/projects/mongodb_odm/1.0/docs/reference/introduction/en#introduction The '/path/to/doctrine/' placeholders are nondescript and confusing to new users, especially when the only way to make them work is to pass in just the path to the DocumentRoot. That should be mentioned, cleaned up, re-purposed, re-clarified, reverted, or whichever adjective of adjustment is suitable. |
| Comments |
| Comment by Jonathan H. Wage [ 03/Sep/10 ] |
|
I don't understand, why did you open this then mark it as invalid? I agree the documentation needs some work, the code has been in heavy development and we try and make the documentation good, but it lacks and gets out of date sometimes. Anyways, I have to be honest your tone here just really irritated to me. Not just irritated, but made me angry. It comes off rude using words like "hideous", "God awful" and other smart ass comments. Remember this is open source, if you don't like something, either make your suggestion in a non asshole way and move on or clone the documentation and fix it yourself! Thanks, Jon |
| Comment by Jonathan H. Wage [ 03/Sep/10 ] |
|
Does this change help? http://github.com/doctrine/mongodb-odm-documentation/commit/a71440c84b013589277636db4992caf64c71c83e http://www.doctrine-project.org/projects/mongodb_odm/1.0/docs/reference/introduction/en#introduction |
| Comment by cainiac [ 03/Sep/10 ] |
|
You sexy man, had I encountered that yesterday, I would have been flying through the setup process! Sorry for the pissy tone in the beginning... my default literary stance is vitriolic polemics and I try my best (and fail) to keep it tucked away. :X The elaboration and the follow-up example at the end will certainly assist future users in gracefully integrating this great solution to their shops. Thanks, John! |
[MODM-110] QueryBuilder missing values and values with wrong data types being inserted Created: 27/Jan/11 Updated: 19/Feb/11 Resolved: 12/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Shards | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
Hello, I'm using annotation mapping for my documents and found something strange when i insert a document (having an embed document) using the query builder... When i use the document class and persist it, things are fine: $testCase = new \Documents\Test(); $testCase->testInt = '0'; $testCase->intfields = new \Documents\Embed\Intfields(); $testCase->intfields->intone = '1'; $testCase->intfields->inttwo = '2'; $dm->persist($testCase); $dm->flush(); Result: } But when i use the query builder: $dm->createQueryBuilder()
->insert('Documents\Test')
->field('testInt')->set('0')
->field('intfields.intone')->set('1')
->field('intfields.inttwo')->set('2')
->getQuery()->execute();
Result: } Intone is missing and the values are all string values. It seems to be a bug, but as i'm new to the doctrine and mongo world, it's more than possible to be a user error. :} I was using the clone version of the master git hub.. is that beta2? Regards PS.: Php files are attached |
| Comments |
| Comment by Jonathan H. Wage [ 11/Feb/11 ] |
|
Hi, phpunit test case? |
| Comment by Jonathan H. Wage [ 12/Feb/11 ] |
|
This is fixed now. |
| Comment by Shards [ 14/Feb/11 ] |
|
thank you =} |
[MODM-112] [PATCH] Allow Hydrator classes to be regenerated only if they are absent Created: 31/Jan/11 Updated: 11/Feb/11 Resolved: 11/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Hydration |
| Affects Version/s: | 1.0.0BETA2 |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Improvement | Priority: | Minor |
| Reporter: | JF Bustarret | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
Hydrator classes are either never generated ou regenerated on each request. The patch add another case : regenerate only if absent. HydratorFactory::$autoGenerate switches to int and can have 3 values : HydratorFactory::AUTOGENERATE_NEVER, HydratorFactory::AUTOGENERATE_ALWAYS or HydratorFactory::AUTOGENERATE_ABSENT |
| Comments |
| Comment by Jonathan H. Wage [ 31/Jan/11 ] |
|
Hi, I don't think this is quite right. We should make this feature match the way proxies are generated. We will need to add a console command to generate the proxies for production. |
| Comment by JF Bustarret [ 02/Feb/11 ] |
|
A console command would need to know the configuration of the factories... It can't be a standalone script. A symfony script would be great (provided it works with symfony < 2), but what about non symfony users ? I added Proxies to my patch, and switched the two const to the Configuration class. |
| Comment by JF Bustarret [ 02/Feb/11 ] |
|
Updated patch with proxies |
| Comment by Jonathan H. Wage [ 11/Feb/11 ] |
|
Hi, I added the console commands for generating proxy and hydrator clases here https://github.com/doctrine/mongodb-odm/commit/56fc267459dd0b972e710b0ff1cab5fbf1859fd9 It will be integrated with DoctrineMongoDBBundle soon. |
[MODM-101] Following documentation still does not produce a working bootstrap. Created: 12/Dec/10 Updated: 19/Feb/11 Resolved: 19/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0BETA2 |
| Type: | Documentation | Priority: | Minor |
| Reporter: | Tony R Quilkey | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Windows Server 2003, IIS6, PHP 5.3.4 |
||
| Description |
|
Setting up following the documentation found at http://www.doctrine-project.org/projects/mongodb_odm/1.0/docs/reference/introduction/en#introduction produces the following errors. PHP Fatal error: Class 'Doctrine\MongoDB\Configuration' not found in C:\Inetpub\sites\phpdev\public\mongodb_odm\lib\Doctrine\ODM\MongoDB\Configuration.php on line 43 () C:\Inetpub\sites\phpdev\public\index.php:0 Is there something missing from the documentation? |
| Comments |
| Comment by Jonathan H. Wage [ 20/Dec/10 ] |
|
Yes, the documentation is not up to date with the latest version in git. The ODM depends on this now https://github.com/doctrine/mongodb |
| Comment by Jonathan H. Wage [ 19/Feb/11 ] |
|
The docs are updated now! |
[MODM-167] Undefined index exception when a new document is detatched in onFlush Created: 26/Jun/12 Updated: 27/Jun/12 Resolved: 27/Jun/12 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | UnitOfWork |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor |
| Reporter: | Tim Roediger | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Test and fix PR to come shortly |
| Comments |
| Comment by Tim Roediger [ 27/Jun/12 ] |
|
Commit a260002 merged to resolve issue. |
[MODM-3] API design Created: 30/Apr/10 Updated: 09/Jun/10 Resolved: 30/Apr/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | 1.0.0ALPHA1 |
| Fix Version/s: | 1.0.0ALPHA1 |
| Type: | Improvement | Priority: | Minor |
| Reporter: | Roman S. Borschel | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
I know I am nit-picky, I'm really just trying to help, but I think methods like save() that were recently added are just API bloat since all it does is persist + flush. The naming is also confusing, having both save and persist. If you really want to add a method to the public API to exchange 2 lines in user code against 1 line, then at least a more descriptive name would be better, like persistAndFlush(). API design is difficult, don't take it too lightly (thats what php did, heh) |
| Comments |
| Comment by Roman S. Borschel [ 30/Apr/10 ] |
|
I think it just really helps ease of use if we keep the different APIs as similar as possible. Of course each can have their own methods, classes etc. We should just not overload the same names with completely different meanings in the different APIs. Concerning this example, it just doesnt look very streamlined if there are such minor extra methods like save/persistAndFlush that you don't have in the other APIs and are neither mongo-specific (mongo-specific methods are fine!). Of course we don't want to fit the same API on all these projects, they should just not be too different in weird ways, like additional non-project-specific convenience methods that are available in one project but not in the other. I hope I explained that well. It's just about a polished API feeling when using the different Doctrine projects. |
| Comment by Jonathan H. Wage [ 30/Apr/10 ] |
|
I had the same thought when I was adding it and I wobbled back and fourth. Now that you say this I agree we should remove it. |
[MODM-24] Hydratation of extra fields Created: 06/Jul/10 Updated: 19/Jul/10 Resolved: 19/Jul/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Hydration |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0ALPHA2 |
| Type: | Improvement | Priority: | Minor |
| Reporter: | Anonymous | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
I'm working on a project using MongoDB with ODM especially for the schemaless features. First, prior to save the document, I add the new mappings (imported from the inherited class) so they will be saved in the database. This part works fine. I've made a quick patch for that, but it doesn't make any type cast, I didn't inspect the code deep enough to make it better. In the Doctrine\ODM\MongoDB\Hydrator class (line 73) : public function hydrate(ClassMetadata $metadata, $document, $data) { $values = array(); // Patch foreach ($data as $field => $value) { if(!array_key_exists($field, $metadata->fieldMappings)) { $document->$field = $value; } } // end Patch foreach ($metadata->fieldMappings as $mapping) { [...] |
| Comments |
| Comment by Jonathan H. Wage [ 19/Jul/10 ] |
|
This is fixed now. Make sure your classes inheritance mapping is setup properly too if you have other problems. |
[MODM-21] AnnotationDriver doesn't allow custom types Created: 28/Jun/10 Updated: 19/Jul/10 Resolved: 19/Jul/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0ALPHA2 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Steven Surowiec | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Right now AnnotationDriver.php does not allow you to create custom types. You can with YAML and XML but the $types array on line ~142 of AnnotationDriver.php is hard coded so there's no way to get a custom type in there. |
[MODM-19] Field annotation missing "name" support Created: 21/Jun/10 Updated: 19/Jul/10 Resolved: 19/Jul/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | 1.0.0ALPHA1 |
| Fix Version/s: | 1.0.0ALPHA2 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Rabbit | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Documentation states that field names can be overriden by using a "name" parameter but Doctrine throws exception. From documentation: Unable to find source-code formatter for language: php. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml /** * @Field(type="string" name="origin") */ protected $country; My source code: Unable to find source-code formatter for language: php. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml /**
* @Field(type="string", name="password")
**/
protected $_password;
Exception: BadMethodCallException: |
[MODM-14] Default database when @Document annotation does not contain a db attribute. Created: 11/Jun/10 Updated: 11/Jun/10 Resolved: 11/Jun/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.0ALPHA2 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Henrik Bjornskov | Assignee: | Jonathan H. Wage |
| Resolution: | Can't Fix | Votes: | 0 |
| Labels: | None | ||
| Description |
|
When a Document is annotated with @Document(collection="test") and is missing the db attribute the ODM defaults to mongo_dev. What i expected was it defaulted to the database name given when creating a connection. |
| Comments |
| Comment by Jonathan H. Wage [ 11/Jun/10 ] |
|
We have no way to retrieve the database you connected to so you have to configure it by setting $config->setDefaultDB('db_name'); |
[MODM-9] Unexpected: MappedSuperclass private property without annotation becomes persisted Created: 03/Jun/10 Updated: 09/Jun/10 Resolved: 03/Jun/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | 1.0.0ALPHA1 |
| Fix Version/s: | 1.0.0ALPHA1 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Florian Kubis | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
OS X, latest ODM checkout |
||
| Description |
/** @MappedSuperclass */
class Model {
private $errors = array();
protected function getErrors() {
return $this->errors;
}
}
/**
* @Document(db="mydb", collection="data")
*/
class Data extends Model {
/**
* @Id
*/
public $id;
/**
* @String
*/
public $name;
}
Did not expect, that $errors goes into mongo. |
| Comments |
| Comment by Jonathan H. Wage [ 03/Jun/10 ] |
|
This is expected behavior. It was changed so that all properties are persisted unless specified otherwise. Map the property is @Transient and it will be ignored by Doctrine: class MyDocument
{
// ...
/** @Transient */
private $errors = array();
}
|
| Comment by Florian Kubis [ 04/Jun/10 ] |
|
Thanks, this works. |
| Comment by Jonathan H. Wage [ 04/Jun/10 ] |
|
Thanks. I have updated the documentation with the new @Transient annotation. |
[MODM-143] Mismatch in configuration classes, can't enable logging Created: 11/May/11 Updated: 16/May/11 Resolved: 16/May/11 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | 1.0.0BETA3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Trivial |
| Reporter: | Stanislav Korchagin | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
My bootstrap:
$config = new Doctrine\ODM\MongoDB\Configuration();
$config->setProxyDir(APPLICATION_PATH . '/../data/cache');
$config->setProxyNamespace('Proxies');
$config->setDefaultDB([skip]);
$config->setHydratorDir(APPLICATION_PATH . '/../data/cache');
$config->setHydratorNamespace('Hydrators');
$config->setLoggerCallable(function(array $log) { print_r($log); });
$reader = new \Doctrine\Common\Annotations\AnnotationReader();
$reader->setDefaultAnnotationNamespace('Doctrine\ODM\MongoDB\Mapping\\');
$config->setMetadataDriverImpl(
new \Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver($reader, __DIR__ . '/Documents')
);
$manager = \Doctrine\ODM\MongoDB\DocumentManager::create(
new \Doctrine\MongoDB\Connection(),
$config
);
And nothing happens Trace from Doctrine\MongoDB\Configuration::getLoggerCallable(): #0 [skip]/Doctrine/MongoDB/Connection.php(248): Doctrine\MongoDB\Configuration->getLoggerCallable()
#1 [skip]/Doctrine/MongoDB/Connection.php(231): Doctrine\MongoDB\Connection->wrapDatabase(Object(MongoDB))
#2 [skip]/Doctrine/ODM/MongoDB/DocumentManager.php(287): Doctrine\MongoDB\Connection->selectDatabase([skip])
#3 [skip]/Doctrine/ODM/MongoDB/DocumentManager.php(316): Doctrine\ODM\MongoDB\DocumentManager->getDocumentDatabase('BPM\User')
#4 [skip]/Doctrine/ODM/MongoDB/Persisters/DocumentPersister.php(148): Doctrine\ODM\MongoDB\DocumentManager->getDocumentCollection('BPM\User')
#5 [skip]/Doctrine/ODM/MongoDB/UnitOfWork.php(319): Doctrine\ODM\MongoDB\Persisters\DocumentPersister->__construct(Object(Doctrine\ODM\MongoDB\Persisters\PersistenceBuilder), Object(Doctrine\ODM\MongoDB\DocumentManager), Object(Doctrine\Common\EventManager), Object(Doctrine\ODM\MongoDB\UnitOfWork), Object(Doctrine\ODM\MongoDB\Hydrator\HydratorFactory), Object(Doctrine\ODM\MongoDB\Mapping\ClassMetadata), '$')
#6 [skip]/Doctrine/ODM/MongoDB/DocumentRepository.php(115): Doctrine\ODM\MongoDB\UnitOfWork->getDocumentPersister('BPM\User')
#7 [skip]application/library/BPM/UserData.php(43): Doctrine\ODM\MongoDB\DocumentRepository->find('4dc9d0192d91365...')
[skip]
get_class($this) from Doctrine\MongoDB\Configuration::setLoggerCallable() write 'Doctrine\ODM\MongoDB\Configuration' like expected, but in getLoggerCallable() write 'Doctrine\MongoDB\Configuration' Do you have any ideas about this behaviour? |
| Comments |
| Comment by Stanislav Korchagin [ 16/May/11 ] |
|
The error was in my bootstrap code: - $manager = \Doctrine\ODM\MongoDB\DocumentManager::create( - new \Doctrine\MongoDB\Connection(), - $config - ); + $manager = \Doctrine\ODM\MongoDB\DocumentManager::create( + null, + $config + ); But confusion still exists, because I used an example from the documentation (http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/introduction.html#setup). |
[MODM-6] Error In Documentation Created: 16/May/10 Updated: 09/Jun/10 Resolved: 20/May/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | 1.0.0ALPHA1 |
| Fix Version/s: | 1.0.0ALPHA1 |
| Type: | Improvement | Priority: | Trivial |
| Reporter: | Sam Smith | Assignee: | Jonathan H. Wage |
| Resolution: | Invalid | Votes: | 0 |
| Labels: | None | ||
| Description |
|
@see http://www.doctrine-project.org/projects/mongodb_odm/1.0/docs/cookbook/getting-started/en The Doctrine\Common\Annotations\AnnotationReader requires an instance Doctrine\Common\Cache\Cache to be passed to it on construction. In the documentation above it is constructed with no such instance. Regards, Sam |
| Comments |
| Comment by Bulat Shakirzyanov [ 16/May/10 ] |
|
check this out - http://github.com/jwage/doctrine2/blob/master/lib/Doctrine/Common/Annotations/AnnotationReader.php#L65 |
[MODM-39] Update project description on the projects page Created: 05/Aug/10 Updated: 17/Aug/10 Resolved: 17/Aug/10 |
|
| Status: | Resolved |
| Project: | Doctrine MongoDB ODM |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Trivial |
| Reporter: | Bulat Shakirzyanov | Assignee: | Jonathan H. Wage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
The projects page http://www.doctrine-project.org/projects says that ODM MongoDB is for PHP 5.3.0, whereas it really is for PHP 5.3.2+, as far as I know. |