Repository navigation
fix . notation support for odm - #674
mamamiapeguin wants to merge 0 commit into
Conversation
|
+1 This works for me but only for embed documents. |
|
@tomcyr , you have to add referenced document's id in the annotation to make it work. Example is at the end of my previous comment. |
|
@mamamiapeguin I tried as You write, but now I have following error: /**
* @GRID\Source(columns="id, name, description, file, threatGroup.id, threatGroup.name, created, updated")
*/
class Threat
.
.
.
/**
* @MongoDB\ReferenceOne(targetDocument="ThreatGroup")
* @GRID\Column(field="threatGroup.id", visible=false)
* @GRID\Column(field="threatGroup.name", title="Threat Group")
*/
private $threatGroup; |
|
@mamamiapeguin I have @mongodb annotation for class (but I not copied here). However I'm preparing fix for referenced columns in Document, so when I'll finish (I must refactor some code) I share this code here so You'll be able to see where's the problem :) |
|
@mamamiapeguin please look at this commit tomcyr@32ee860 This works for me for @mongodb\ReferenceOne mappings (without sorting). /**
* @MongoDB\Document
* @GRID\Source(columns="id, referenceColumn, referenceColumn.name")
*/
class DocumentExample
.
.
.
/**
* @MongoDB\ReferenceOne(targetDocument="referenceDocument")
* @GRID\Column(field="referenceColumn", visible=false)
* @GRID\Column(field="referenceColumn.name")
*/
private $referenceColumn;There isn't other way to find Documents in MongoDB by referenced columns in other Document. |
|
@mamamiapeguin ping! could you test if this is working now. Tests are passed but I'd like to hear from you. |
|
@hmert checked. It works well. |
|
@mamamiapeguin Hey, it has a conflict right now. |
Actually '.' notation works well when executing the query. The following filling record into row caused the data missing.
So I added the logic to handle '.' notation at
APY\DataGridBundle\Grid\Source\Document::execute() line 205In case of annotation field differs in uppercase/lowercase from actual class property , I had them unified in lowercase:
To access referenced document's property, the referenced document's id is a must whatever actual property is eventually retrieved.
At class annotation:
At property 'owner' annotation: