gallas12 / php-linq

linq v programovacím jazyce php naprogramovaný metodikou oop
7 stars 6 forks source link

Class path problem with case sensitive file system #2

Open yookoala opened 4 years ago

yookoala commented 4 years ago

Problem

  1. The directories in this repository is named in small cases (''linq/factory", "linq/helper") but the namespace names used are capitalized ("Linq/Factory", "Linq/Helper")
  2. The composer autoloader loads the file by matching the namespace path to the directory path. The directory path resolves depends on the file system.
  3. Most filesystem are designed to be case sensitive (i.e. APFS of macOS, bascially all filesystem in Linux of Unix).
  4. Since (1), the autoloader cannot find the small cap directories by the capitalized namespace .

Example

<?php

require 'vendor/autoload.php';

$linq = LinqFactory::createLinq();
    return $linq->from([
     ['name' => 'Alice'],
     ['name' => 'Bob'],
   ]);

If you are running this on a case sensitive file system (i.e. macOS, Linux, or most system other than Windows), you will run into this error:

Class 'Linq\Factory\JoinFactory' not found
in vendor/linq/php-linq/linq/LinqFactory.php line 25

Solution

Just rename capitalize all directories within "linq" folder.