laravel-odbc icon indicating copy to clipboard operation
laravel-odbc copied to clipboard

PSR-4 autoloader instead of class map

Open Enrica-r opened this issue 3 years ago • 3 comments

In the composer.json file is call map used for autoloading:

	"autoload": {
		"classmap": [
			"src"
		]
	},

I would recommend to use PSR-4 for follwing reasons:

  • Lavarel standard is PSR-4
  • Classes in subfolders like src/grammars are loaded automatically with namespace Abram\ODBC\Grammars
  • This opens the possibility to add grammars for different databases eg. SAP SQL Anywhere via Pull request
   "autoload": {
        "psr-4": {
            "Abram\\ODBC\\": "src/"
        }
    },

With current solution I have to put the grammar classes in 'App' Folder somewhere in order that autoloader can find the grammar classes.

Enrica-r avatar Mar 16 '21 12:03 Enrica-r

Hi, can you PR this feature?

andreossido avatar Jan 30 '22 14:01 andreossido

Hi @Enrica-r

I am also working with SAP HANA SQL. I used this ODBC to connect with HANA SQL. It is working fine. But migrations are not working. If you know any solution please, help me.

prasanth-j avatar Apr 23 '22 04:04 prasanth-j

Hi @prasanthjayakumar The default grammars doesn't work for all databases. I used SQLAnywhere database 2 years ago. So I found in another repo a query grammar and a schema grammar class. I modified this and copied it in a folder "grammar" within database/grammar. Check that this folder is loaded in composor.json (psr-4). Then define the two files in your database options of your odbc driver. The array has a property options.grammar.query or ...schema. If there doesn't exist grammar classes for Hana SQL so you have to write it by yourself.

Enrica-r avatar Apr 24 '22 19:04 Enrica-r