Git Product home page Git Product logo

Comments (5)

yo1nick avatar yo1nick commented on June 27, 2024 1

You can say that, I managed to get rid of the error in question, this is what I have done:
step 1: from composer remove
"post-install-cmd": [ "@auto-scripts" ], "post-update-cmd": [ "@auto-scripts" ]
step 2: run composer require ongr/elasticsearch-bundle
step 3: put back post-install and post-update
step 4: edit vendor/ongr/elasticsearch-bundle/DependencyInjection/Compiler/MappingPass.php
I've made 2 changes to that file first in private function getFullNamespace($filename) I add trim to preg_match like that:
preg_match('/^namespace (.*);$/', trim($namespaceLine), $match);
and the second change is in private function getClassname($filename) I replace $directoriesAndFilename = explode('/', $filename); with $directoriesAndFilename = explode(DIRECTORY_SEPARATOR, $filename);

Hope that helps you!

from elasticsearchbundle.

bogdaniel avatar bogdaniel commented on June 27, 2024

Have you managed to install it ? If it's an yes can you provide the solution? Thanks

from elasticsearchbundle.

bogdaniel avatar bogdaniel commented on June 27, 2024

Thank you I will try it.

LE: It Worked smooth the way you did it :-) thank you for the fix but I encountered another problem.
After looking over the issues and everything I finally made it to work with the following changes

#899
#952

    private function getFullNamespace($filename)
    {
        $lines = preg_grep('/^namespace /', file($filename));
        $namespaceLine = array_shift($lines);
        $match = array();
        preg_match('/^namespace (.*);$/', trim($namespaceLine), $match);
        $fullNamespace = array_pop($match);

        return $fullNamespace;
    }

    private function getClassname($filename)
    {
        $directoriesAndFilename = explode(DIRECTORY_SEPARATOR, $filename);
        $filename = array_pop($directoriesAndFilename);
        $nameAndExtension = explode('.', $filename);
        $className = array_shift($nameAndExtension);

        return $className;
    }

from elasticsearchbundle.

mjvanmiddelaar avatar mjvanmiddelaar commented on June 27, 2024

See also #958

you could also add something similar to:

ongr_elasticsearch:
    source_directories: [/src/Document]

in packages/ongr_elasticsearch.yaml

from elasticsearchbundle.

Orest983 avatar Orest983 commented on June 27, 2024

MappingPass.php

function getFullNamespace
line 169: preg_match('/^namespace (.*);$/', $namespaceLine, $match);

$namespaceLine - in some cases is a string with '\r\n' at the end, for example "namespace App\Twig;\r\n"
thus preg_match returns null, that causes an error "In MappingPass.php line 65: Class \AppExtension does not exist"

It isn't right, but I solved this problem by wrapping the argument into a function rtrim($namespaceLine)

from elasticsearchbundle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.