Open jkwakman opened 6 years ago
I will test your pull-request in the end of the week
Dear Florian,
Thank you for you're time reviewing my PR. I have added the following changes (see commits):
testGetFields_NoParentGetter testGetFields_UnkownParentGetterMethod testGetFields_NoFieldAlias testGetFields_NoFieldGetter testGetFields_UnknownFieldGetter
Can you please reevaluate my PR? If you require any further information, feel free to contact me.
Kind regards,
Jack Kwakman
I have tested your feature with an Post
entity that has a tags
property.
/**
* @Solr\Fields(getter="getTags", fields={
* @Solr\Field(type="integers", getter="getId", fieldAlias="id"),
* @Solr\Field(type="strings", getter="getName", fieldAlias="name")
* })
*
* @ORM\OneToMany(targetEntity="Acme\DemoBundle\Entity\Tag", mappedBy="post", cascade={"persist", "remove"})
*/
private $tags;
When I persist a post then an error is logged:
solr.DEBUG: Unknown method defined "getId" in class "Acme\DemoBundle\Entity\Post"
Post
has an getId
method, but I would expect that Tag::getId
is called in this case.
$post = new Post();
$post->setTitle('post with fields');
$post->setText('text');
$tag1 = new Tag();
$tag1->setName('tag #1');
$tag2 = new Tag();
$tag2->setName('tag #2');
$post->setTags([$tag1, $tag2]);
// save $post comes here....
Did I have misunderstood the documentation?
Dear Florian,
I have reevaluated the changes with the example in the docs. I have e-mailed the example entities so we can be sure we test the same setup. These entities are working without errors on my side and update the Solr database with the following result:
{ "id":"post_15", "id_is":[29,30], "name_ss":["tag #1","tag #2"], "version":1615765069600129024}] } The tag id's are grouped in the id_is property and the names are grouped under the name_ss. This setup also works for @ManyToOne relationships and can be defined with the same annotation syntax.
Can you please (re)reevaluate my PR? If you require any further information, feel free to contact me.
Kind regards,
Jack Kwakman
Bundled all changes into one PR. Merging and maintaining all the separate PR's causes a mess.