laravel-doctrine / orm

A drop-in Doctrine ORM 2 implementation for Laravel 5+ and Lumen

Home Page:http://laraveldoctrine.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No longer recognizes custom functions after update

tiagooliveira1 opened this issue · comments

Please prefix your issue with one of the following: [BUG] [PROPOSAL] [QUESTION].
QUESTION

Package version, Laravel version

Laravel-doctrine:1.6.7/ Laravel 7.30.6

Expected behaviour

Actual behaviour

I'm getting a Class not Found message :

Error {#2776
  #message: "Class "ModuloFinanceiro\Http\Functions\FinGetSaldoConta" not found"
  #code: 0
  #file: "/emitefacil-laravel/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php"
  #line: 3564
  trace: {
    /emitefacil-laravel/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php:3564 {
      Doctrine\ORM\Query\Parser->CustomFunctionsReturningNumerics() …
      › $function = is_string($functionClass)
      ›     ? new $functionClass($functionName)
      ›     : $functionClass($functionName);
    }
...

The class is defined in the correct folder and namespace, and folder permissions are ok.

namespace ModuloFinanceiro\Http\Functions;
class FinGetAccountBalance extends FunctionNode {

}

In config/doctrine.php the function is defined as:

'custom_numeric_functions'  => [
        'FinGetSaldoConta' => \ModuloFinanceiro\Http\Functions\FinGetSaldoConta::class
    ],

Before that I was using Laravel 5.8 and Laravel-Doctrine 1.4.16 and it worked correctly.

Steps to reproduce the behaviour

Create a Custom Numeric function class, save it in a folder in the project, and then configure it in config/doctrine.php

have you tried composer dump and is your namespace correctly defined in composer.json

have you tried composer dump and is your namespace correctly defined in composer.json

Thank you @dpslwk . There are actually several errors in composer dump-autoload. I correctly adjusted the namespaces and it worked. Thank you very much. My mistake.