ElasticsearchBundle
ElasticsearchBundle copied to clipboard
Mapping for Embed not working when its extended
- PHP: 7.0
- ElasticSearch: 5
- Ongr: 5.0.2
It use the false folder when an embed is from an extended Document: https://github.com/ongr-io/ElasticsearchBundle/blob/v5.0.2/Mapping/DocumentParser.php#L599. The guessDirName
returns for SuluArticleBundle:ExcerptViewObject
the Bundle/WebsiteBundle/Document/
instead of Document
. A strange namespace is then generate Sulu/Bundle/ArticleBundle/Bundle/WebsiteBundle/Document
in https://github.com/ongr-io/ElasticsearchBundle/blob/v5.0.2/Mapping/DocumentParser.php#L572.
Folder Structure:
- src
- Client
- Bundle
- WebsiteBundle
- Document
- ArticleViewDocument extends ArticleBundle:ArticleViewDocument
- vendor
- sulu
- article-bundle
- Document
- ArticleViewDocument
- ExcerptViewObject
ArticleBundle:ArticleViewDocument
/**
* @var ExcerptViewObject
*
* @Embedded(class="SuluArticleBundle:ExcerptViewObject")
*/
protected $excerpt;
@saimaz this issue make more and more problems in our projects can you give me some feedback?
I'll take a look what is the problem here and let you know.
@saimaz any news? do you need more information? should I create a test project where the error appears?
I'm trying to repeat the error. No luck yet. The way you are trying to use the mapping is very rare :). I can imagine what you want to achieve and will try to work on a possible solution.
@saimaz The problem is that it use the current document dir for embedded object instead of the one of that namespace. If I completely removes that the document parser care about Document Dirs (https://github.com/ongr-io/ElasticsearchBundle/pull/804) it works. Think only the document finder should care about document how they should be loaded.
If you use ongr in a third party bundle you want that the developer who use it can extend document. I know its not a normal project use case where all your documents are in the src/AppBundle/Document.
+1
+1
+1
+1
Added v6 label to test this if it works well in the upcoming v6 major version.
@saimaz want to mention it that this bug did only happen with the :
syntax the last time I did test it. It did not happened when using FQCN.