Closed foulong closed 4 years ago
Hi,
If I understand correctly, your code search for the MantisBugTableModel
class in namespace Vendor\Project\MyDb\PublicSchema
(as the error says)
But you generated Model file under the Vendor\Project\Model\MyDb\PublicSchema
, see the Model
subfolder just before MyDB
which is not in the error.
Maybe you forgot/misstyped the namespace in your code, you should have something like:
<?php
namespace Your\Namespace;
use Vendor\Project\Model\MyDb\PublicSchema\MantisBugTableModel;
class YourClass {
...
Hi @rdavaillaud ,
exact ! Thx. I forgot the Model subfolder.
Corrections below :
composer.json (I added "Model" subfolder) :
"autoload": {
"psr-4": {
"Vendor\\Project\\": "sources/lib"
}
},
In my script (I added "Model" subfolder) :
$bugs = $pomm['my_db']
->getModel('\Vendor\Project\Model\MyDb\PublicSchema\MantisBugTableModel');
Hello,
I experiment pomm, and i'm practicing with the documentation (get started).
At the end of this documentation, i wrote that : $bugs = $pomm['my_db'] ->getModel('\Vendor\Project\MyDb\PublicSchema\MantisBugTableModel') ->findWithWhere1(new Where('reporter_id', 6));
It generates errors below : Fatal error: Uncaught PommProject\ModelManager\Exception\ModelException: Could not instantiate Model class '\Vendor\Project\MyDb\PublicSchema\MantisBugTableModel'. (Reason: 'Class \Vendor\Project\MyDb\PublicSchema\MantisBugTableModel does not exist'). in D:__wamp64\www\pomm\get_started\vendor\pomm-project\model-manager\sources\lib\Model\ModelPooler.php on line 60
I've seen an other issue (https://github.com/pomm-project/ModelManager/issues/82). However, i don't understand that needs of pomm, to run correctly. I must change composer.json file, its'ok, but what do i change ?
vendor\ .pomm_cli_boostrap.php test1. php (contains the main program, where i use pomm) composer.json sources\lib\Model\MyDb\PublicSchema{allModelsOfMySchema}
composer.json :
beginning of a Model file in sources\lib\Model\MyDb\PublicSchema :
How do i change composer.json, test1.php, to run correctly pomm ?
Thanks in advance.