pomm-project / ModelManager

Model Manager for the Pomm database framework.
MIT License
66 stars 27 forks source link

Possibly missing information in Quick Pomm2 setup #82

Closed zirhut closed 6 years ago

zirhut commented 7 years ago

I am trying to build a new site using http://www.pomm-project.org/documentation/sandbox2 There is a problem at one point (until this line everything is ok): $computers = $pomm['cbkmis']->getModel('\CbkMis\PublicSchema\ComputerModel'); Generates an error (from error.log of apache): PHP Fatal error: Uncaught PommProject\\ModelManager\\Exception\\ModelException: Could not instantiate Model class '\\CbkMis\\PublicSchema\\ComputerModel'. (Reason: 'Class \\CbkMis\\PublicSchema\\ComputerModel does not exist'). in /var/www/html/cbk-mis/vendor/pomm-project/model-manager/sources/lib/Model/ModelPooler.php:60

If I check included files (before I call getModel) with get_included_files(); I get only files within the vendor directory (nothing from the source directory)... it might be the problem. But how is it possible to fix it?

This issue asks developer to update the tutorial: Quick setup 2.0

Pomm version is: 2.0.*@dev PHP version is: 7.0.22-0ubuntu0.16.04.1

chanmix51 commented 7 years ago

Yes, the tutorial assumes everything lies in the root directory of the project in order not to go into the quirks of composer.

Let’s say your sources lie in sources/lib, your composer.json must contain the following lines:

    "autoload": {
        "psr-4": {
            "MyVendor\\MyProject\\": "sources/lib"
        }
    },

This way, calling a class MyVendor\MyProject\Pomm\Model\MyDb\MySchema\StuffModel will result in loading the file in sources/lib/Pomm/Model/MyDb/MySchema/StuffModel.php

stood commented 6 years ago

@zirhut it's ok? we can closed this issue?

chanmix51 commented 6 years ago

The site has been updated with reference to this issue.