Closed zquintana closed 8 years ago
:+1:
I will review/test it later today
I have test your pull-request a bit and I found some points:
Error: Call to a member function getTitle() on null, FS/SolrBundle/Doctrine/Mapper/Mapping/MapAllFieldsCommand.php at line 46
. In your case it would be $tag->getPost()
My config: Post
/**
* @var Category
*
* @Solr\Field(type="string", getter="getTitle")
* @ORM\ManyToOne(targetEntity="Acme\DemoBundle\Entity\Category", inversedBy="posts")
* @ORM\JoinColumn(name="category_id", referencedColumnName="id")
*/
private $category;
Category
/**
* @var Post[]
*
* @Solr\Field(type="strings", getter="getTitle")
* @ORM\OneToMany(targetEntity="Acme\DemoBundle\Entity\Post", mappedBy="category")
*/
private $posts;
Looks like the problem was that I didn't have logic in place to make sure the entity was in place. Fix it now. In my latest patch.
Just realized the this branch I pushed, by accident fixes for the newest solarium versions. I can remove that if need be. Let me know.
Any update on this?
I am working on this "relation-problem", based on this pull-request
Sorry guys. Here's the update. Problem is that I've added a few more features into my branch. I added VirtualFields properties and fixed an issue with the doctrine hydrator that would query n amount of records from the database during hydration. Switched that to a find all so it would be one query rather then n. I also added a basic DataCollector so that you can see the actual queries being passed to Solr. Problem is that all of that is on my dev branch. @floriansemm how would you like me to arrange this for you to pull in?
Sorry for the delay again. We needed this for a project we're working on so had to build it quickly.
@zquintana you can create another pull-request for your new features or attach them to this pull-request. Then I will merge your changes into the zquintana-related_entities
branch which contains all the related-entities stuff.
Added related entities support via adding getter name property to the Field annotation. So adding the related entity is as simple as: