Closed wachterjohannes closed 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.
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?
could you post your xml and class file?
and also a stacktrace?
could it be that you define your index with <index property="contact" />
instead <index value="contact" />
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
could you please post your xml i think you use expr="object.id
to get the id instead of property="id"
-
Here it is:
</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.
in a expression you have to use the function directly in your case object.getId()
there is already an issue in symfony which discuss this fact https://github.com/symfony/symfony/issues/18520
the rest should be valid in my oponion. so if this works for you we can merge that. /cc @danrot
Ahh, okay. Thanks for the hint. Changing it to the name of the method works as intended.
I would propose that you also make it clear in your docs. It isn't obvious at the moment, because f.e. <url expr="'/path/to/' ~ object.id" />
is used everywhere.
Thanks again for your effort!
@benbender i have already updated the docs in this PR. thanks for you help!
@dantleech if the tests are green we can merge it. /cc @chirimoya should we create a new version?
@danrot changed to 2.7 how will we release this? 0.15 or 0.14.1?
This change requires a 0.15.0
I'd say.
i also think so. then we have to aware of changes until the next release.
@danrot @dantleech ping
backref: sulu/sulu#2106
This PR updates the dependencies to allow symfony 3.
Fixes #81