massiveart / MassiveSearchBundle

MIT License
68 stars 24 forks source link

Updated dependencies for symfony 3 #83

Closed wachterjohannes closed 8 years ago

wachterjohannes commented 8 years ago

This PR updates the dependencies to allow symfony 3.

Fixes #81

wachterjohannes commented 8 years ago

@benbender could you try to include dev-feature/symfony3 in your project? the tests are running after updating the dependencies. also locally for me it seems to work on the first look.

benbender commented 8 years ago

I tried the branch and have to report, that it fails the same way as before. It tries to access a property on my entity named after the index-name - and fails.

F.e. on a entity named event with an index named "eventfoo" i got the following exception:

  [Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException]
  Neither the property "eventfoo" nor one of the methods "getEventfoo()", "eventfoo()", "isEventfoo()", "hasEventfoo()", "__get()" exist and have public ac
  cess in class "AppBundle\Entity\Event".

Any idea on this?

wachterjohannes commented 8 years ago

could you post your xml and class file?

wachterjohannes commented 8 years ago

and also a stacktrace?

wachterjohannes commented 8 years ago

could it be that you define your index with <index property="contact" /> instead <index value="contact" />

benbender commented 8 years ago

Ahh, you found the right path - it's in fact a documentation issue. I followed the documentation here: http://massivesearchbundle.readthedocs.org/en/latest/introduction.html

And used <index NAME="post">

But there seems to be another glitch. With <id property="id" /> and id defined as private property and a getter, i get the following exception. Defining $id as public works and fails only for the id:

Fatal error: Cannot access private property AppBundle\Entity\Post::$id in /Users/bb/Desktop/c4a/vendor/symfony/symfony/src/Symfony/Component/ExpressionLanguage/Node/GetAttrNode.php on line 78 PHP Stack trace: PHP 1. {main}() /Users/bb/Desktop/c4a/bin/console:0 PHP 2. Symfony\Component\Console\Application->run() /Users/bb/Desktop/c4a/bin/console:29 PHP 3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() /Users/bb/Desktop/c4a/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:117 PHP 4. Symfony\Component\Console\Application->doRun() /Users/bb/Desktop/c4a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:80 PHP 5. Symfony\Component\Console\Application->doRunCommand() /Users/bb/Desktop/c4a/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:186 PHP 6. Symfony\Component\Console\Command\Command->run() /Users/bb/Desktop/c4a/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:807 PHP 7. Massive\Bundle\SearchBundle\Command\ReindexCommand->execute() /Users/bb/Desktop/c4a/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:256 PHP 8. Massive\Bundle\SearchBundle\Command\ReindexCommand->reindexClass() /Users/bb/Desktop/c4a/vendor/massive/search-bundle/Command/ReindexCommand.php:149 PHP 9. Massive\Bundle\SearchBundle\Search\SearchManager->index() /Users/bb/Desktop/c4a/vendor/massive/search-bundle/Command/ReindexCommand.php:219 PHP 10. Massive\Bundle\SearchBundle\Search\ObjectToDocumentConverter->objectToDocument() /Users/bb/Desktop/c4a/vendor/massive/search-bundle/Search/SearchManager.php:136 PHP 11. Massive\Bundle\SearchBundle\Search\Metadata\FieldEvaluator->getValue() /Users/bb/Desktop/c4a/vendor/massive/search-bundle/Search/ObjectToDocumentConverter.php:83 PHP 12. Massive\Bundle\SearchBundle\Search\Metadata\FieldEvaluator->getExpressionValue() /Users/bb/Desktop/c4a/vendor/massive/search-bundle/Search/Metadata/FieldEvaluator.php:58 PHP 13. Symfony\Component\ExpressionLanguage\ExpressionLanguage->evaluate() /Users/bb/Desktop/c4a/vendor/massive/search-bundle/Search/Metadata/FieldEvaluator.php:120 PHP 14. Symfony\Component\ExpressionLanguage\Node\BinaryNode->evaluate() /Users/bb/Desktop/c4a/vendor/symfony/symfony/src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php:70 PHP 15. Symfony\Component\ExpressionLanguage\Node\GetAttrNode->evaluate() /Users/bb/Desktop/c4a/vendor/symfony/symfony/src/Symfony/Component/ExpressionLanguage/Node/BinaryNode.php:112

wachterjohannes commented 8 years ago

could you please post your xml i think you use expr="object.id to get the id instead of property="id"-

benbender commented 8 years ago

Here it is:

<url expr="'/post/' ~ object.id" /> <description property="teaser" /> <image expr="'/assets/images/' ~ object.id" /> <fields> <field name="title" type="string" /> <field name="body" type="string" /> </fields> </mapping> <pre><code> </massive-search-mapping>```` But you are on the right track again. If I remove the mappings for url and image, it works as "intended". So usage of the expression language "fails" atm for sf3.</code></pre> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/wachterjohannes"><img src="https://avatars.githubusercontent.com/u/1464615?v=4" />wachterjohannes</a> commented <strong> 8 years ago</strong> </div> <div class="markdown-body"> <p>in a expression you have to use the function directly in your case <code>object.getId()</code></p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/wachterjohannes"><img src="https://avatars.githubusercontent.com/u/1464615?v=4" />wachterjohannes</a> commented <strong> 8 years ago</strong> </div> <div class="markdown-body"> <p>there is already an issue in symfony which discuss this fact <a href="https://github.com/symfony/symfony/issues/18520">https://github.com/symfony/symfony/issues/18520</a></p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/wachterjohannes"><img src="https://avatars.githubusercontent.com/u/1464615?v=4" />wachterjohannes</a> commented <strong> 8 years ago</strong> </div> <div class="markdown-body"> <p>the rest should be valid in my oponion. so if this works for you we can merge that. /cc @danrot </p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/benbender"><img src="https://avatars.githubusercontent.com/u/462455?v=4" />benbender</a> commented <strong> 8 years ago</strong> </div> <div class="markdown-body"> <p>Ahh, okay. Thanks for the hint. Changing it to the name of the method works as intended.</p> <p>I would propose that you also make it clear in your docs. It isn't obvious at the moment, because f.e. <code><url expr="'/path/to/' ~ object.id" /></code> is used everywhere.</p> <p>Thanks again for your effort! </p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/wachterjohannes"><img src="https://avatars.githubusercontent.com/u/1464615?v=4" />wachterjohannes</a> commented <strong> 8 years ago</strong> </div> <div class="markdown-body"> <p>@benbender i have already updated the docs in this PR. thanks for you help!</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/wachterjohannes"><img src="https://avatars.githubusercontent.com/u/1464615?v=4" />wachterjohannes</a> commented <strong> 8 years ago</strong> </div> <div class="markdown-body"> <p>@dantleech if the tests are green we can merge it. /cc @chirimoya should we create a new version?</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/wachterjohannes"><img src="https://avatars.githubusercontent.com/u/1464615?v=4" />wachterjohannes</a> commented <strong> 8 years ago</strong> </div> <div class="markdown-body"> <p>@danrot changed to 2.7 how will we release this? 0.15 or 0.14.1?</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/danrot"><img src="https://avatars.githubusercontent.com/u/405874?v=4" />danrot</a> commented <strong> 8 years ago</strong> </div> <div class="markdown-body"> <p>This change requires a <code>0.15.0</code> I'd say. </p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/wachterjohannes"><img src="https://avatars.githubusercontent.com/u/1464615?v=4" />wachterjohannes</a> commented <strong> 8 years ago</strong> </div> <div class="markdown-body"> <p>i also think so. then we have to aware of changes until the next release.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/wachterjohannes"><img src="https://avatars.githubusercontent.com/u/1464615?v=4" />wachterjohannes</a> commented <strong> 8 years ago</strong> </div> <div class="markdown-body"> <p>@danrot @dantleech ping</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/QuingKhaos"><img src="https://avatars.githubusercontent.com/u/993350?v=4" />QuingKhaos</a> commented <strong> 8 years ago</strong> </div> <div class="markdown-body"> <p>backref: sulu/sulu#2106</p> </div> </div> <div class="page-bar-simple"> </div> <div class="footer"> <ul class="body"> <li>© <script> document.write(new Date().getFullYear()) </script> Githubissues.</li> <li>Githubissues is a development platform for aggregating issues.</li> </ul> </div> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script> <script src="/githubissues/assets/js.js"></script> <script src="/githubissues/assets/markdown.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/highlight.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/go.min.js"></script> <script> hljs.highlightAll(); </script> </body> </html>