Closed AntonioCS closed 7 years ago
Only annotations are supported.
Well.. that is unfortunate.. Any plans in the pipeline to use anything else besides annotations?
no because there are no requests for this features (excepting you)
Would this be something complicated to add? I can't change the way things are due to legacy issues and those entities I am dependent on being in the vendor folder.
I have never think about it how to implement a new mapping. So I don't know how complicated it would be.
To solve your problem: you can implement a DTO which uses the vendor-entity:
class WrapperDTO
{
/** @Solr\Field() */
private $vendorProperty1;
/** @Solr\Field() */
private $vendorProperty2;
public function __construct($vendorEntity)
{
$this->vendorProperty1 = $vendorEntity->getProperty1();
$this->vendorProperty2 = $vendorEntity->getProperty2();
}
}
I can't see how I am going to load this when I run the populate command. I see that the entity will be passed in the construct but how do I wire this up? As a service? How will your bundle read this exactly?
Sorry I am just not understanding fully your solution.
You can't use the existing populate command. You have to implement your own. It would be something like this:
// fetch all vendor-entities
foreach ($vendorEntity as $vendorEntity) {
$dto = new WrapperDTO($vendorEntity);
$this->get('solr.client')->updateDocument($dto);
}
Great! I was already implementing a "hook" on your populate command so that I could populate solr with the missing entity.
Thanks again for all your help.
Hey,
I am working on a project that depends on entities that are provided by third party bundles (in the vendor folder). Is there any way to create the mappings without using the annotations? Some yml, json or xml mappings that will do the same as the annotations but without having to change the entities?
Thanks!