Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mongodb ODM missing support for . notation #32

Closed
ghost opened this issue Oct 9, 2011 · 2 comments
Closed

mongodb ODM missing support for . notation #32

ghost opened this issue Oct 9, 2011 · 2 comments
Milestone

Comments

@ghost
Copy link

ghost commented Oct 9, 2011

No description provided.

@ghost ghost self-assigned this Oct 9, 2011
@Abhoryo Abhoryo mentioned this issue May 4, 2012
@Abhoryo
Copy link
Member

Abhoryo commented Jun 16, 2012

I've try a little mongodb but it is very instable on windows. And I'm not enought skilled with this ODM.

@mamamiapeguin
Copy link
Contributor

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 205

foreach ($columns as $column) {
      $hierarchy = explode('.', $column->getId());
      $length = count($hierarchy);
      $node = $resource;
      for ($i = 0; $i < $length; $i++) {
            if (isset($node)) {
                 $node = $this->getClassProperties($node);
                 $node = $node[strtolower($hierarchy[$i])];
            }
      }
      $row->setField($column->getId(), $node);
}

In case of annotation field differs in uppercase/lowercase from actual class property , I had them unified in lowercase:

$result[strtolower($property->getName())] = $property->getValue($obj);

To access referenced document's property, the referenced document's id is a must whatever actual property is eventually retrieved.
At class annotation:

@GRID\Source(columns = "id, owner.id, owner.username")

At property annotation:

@GRID\Column(field = "owner.id", visible = false)
@GRID\Column(field = "owner.username")

@Abhoryo , could you merge my pull request #674 and add the reference document usage to the Guide.
Thanks

@hmert hmert modified the milestone: 2.3 Dec 13, 2015
@qferr qferr mentioned this issue Dec 21, 2015
29 tasks
@qferr qferr closed this as completed Jan 29, 2016
@hmert hmert changed the title mongodb ODM missing support for . notation mongodb ODM missing support for . notation Jan 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants