Closed jmogilner closed 5 years ago
You must use hydration to filter by this ID, if not you will get only the index relation document
I have added a PR for this feature request: https://github.com/floriansemm/SolrBundle/pull/187
I hope Florian is willing to merge some of my work back to the master branche. You can index multiple fields with the following syntax:
/**
* @var Tag[] $tag
*
* @ORM\OneToMany(targetEntity="Acme\DemoBundle\Entity\Tag", mappedBy="post", cascade={"persist"})
* @Solr\Fields(getter="getTags", fields={
* @Solr\Field(type="integers", getter="getId", fieldAlias="id"),
* @Solr\Field(type="strings", getter="getName", fieldAlias="name")
* })
*/
private $tags;
Merged all the PR's into one big PR see: https://github.com/floriansemm/SolrBundle/pull/188
You can test this feature before merge by adding the following changes to the composer.json:
"repositories": [ { "type": "vcs", "url": "https://github.com/jkwakman/SolrBundle/" } ], "require": "floriansemm/solr-bundle": "dev-dev-master-composer"
I'm unable to find a way to index 2 fields (id and name) of a relation. I want to be able to filter by id, and display the name in the results, without doctrine hydration. Is there any way to accomplish this?
Thank you for your work!