Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model Classes, Rooms, etc. not found #17

Closed
InTerestedOWL opened this issue Apr 30, 2018 · 11 comments
Closed

Model Classes, Rooms, etc. not found #17

InTerestedOWL opened this issue Apr 30, 2018 · 11 comments
Assignees
Milestone

Comments

@InTerestedOWL
Copy link

InTerestedOWL commented Apr 30, 2018

Hello Mr. Franek,
I am using your API for a project in school, but I am getting the error, that every standard-Model (Classes, Teachers, Rooms, Substitutions and so on) can't be found. I am a little bit in struggle, because it have to be finished next week on monday. Here is the Code I have so far:

try {
$config = new WebuntisConfiguration([
'admin' => [
'server' => '',
'school' => '',
'username' => '',
'password' => ''
],
'only_admin' => true,
'disableCache' => true
]);
var_dump($config); //Contains an object of WebuntisConfiguration
error_log("Config ist eingeladen!");
$query = new Query();
var_dump($query); //Contains an object of Query, but array models is 0, but array repository is 2
$aClasses = $query->get('Classes')->findAll();
return $aClasses;
} catch (Exception $oException) {
error_log($oException->getMessage());
}

I have it installed with the composer and the php-version is up to date.

Hope to hear as fast as possible from you. Thanks!

Hab gerade gemerkt, dass du Deutsch sprichst. Kannst somit gerne auf Deutsch antworten!

@TobiasFranek
Copy link
Owner

Hey,

I would rather answer in english because if someone has the same problem that can be solved too. So to see whats really going on there i have to see some more things like the exact error message. Did you check the folder in vendor if all necessary files are there?

@InTerestedOWL
Copy link
Author

InTerestedOWL commented Apr 30, 2018 via email

@TobiasFranek
Copy link
Owner

did you install the package via composer? because if you did there should be an vendor folder in your project root directory.

@InTerestedOWL
Copy link
Author

InTerestedOWL commented May 1, 2018

yes my projectmanager has installed it over composer. composer is installing into an directory named libs. So we don't have any root directory and i don't see any vendor directory. Is there any way to make this directory after the composer has installed the api?

@InTerestedOWL
Copy link
Author

Okay the libs directory is the vendor directory, but I can't get any models. That' s the problem. The libs directory contains the tfranek/webuntis/<src\bin\docs>/ directories, but it isn't able to load any Model?

@TobiasFranek
Copy link
Owner

The problem is somehow the YAMLConfiguration Class cannot find the meta data of the Models (.webuntis.yml) which are located at src/Resources/config/. Maybe it is because the glob() function is not working probably on your system. What could also be is that you execute the script outside the root directory (the libs folder is in the hierarchy below the executed script) that could result in not finding the model because it only searches for models in the directory of the executed script and above.

@TobiasFranek
Copy link
Owner

and which os are you using? on linux there could be a problem with the access rights.

@hendrikheil
Copy link

Hi there,

I am the "project manager" / old developer of the software @programerTV is trying to work on. We just resolved the issue! You were absolutely right with your guess.
If others may have similar issues here is how we were able to solve it:
We had our composer config set up to install libraries into libs/ instead of vendor/. We just changed our composer.json back to the default directory and voila: The globbing was working fine once again. If "vendor" in YAMLConfiguration.php was changed to "libs" that would also resolve the issue, but well that wasn't really desirable for obvious reasons 😄

By the way, our script was calling from /core/controllers/somecontroller.php. Composer had it's installation directory in /libs - is that what you meant with

What could also be is that you execute the script outside the root directory (the libs folder is in the hierarchy below the executed script) that could result in not finding the model because it only searches for models in the directory of the executed script and above.

?

Any way, we got it working now! Thanks a bunch for your help!

@TobiasFranek
Copy link
Owner

If I work on the next patch I will maybe include a option to add an additional path for the configuration.

@TobiasFranek TobiasFranek self-assigned this May 2, 2018
@TobiasFranek TobiasFranek added this to the 2.3 milestone May 2, 2018
@TobiasFranek TobiasFranek reopened this May 2, 2018
@TobiasFranek
Copy link
Owner

but if you want you can also add this feature. Just try to code it out and make a commit and i will review it.

@hendrikheil
Copy link

Well, I didn't really dive into the code too deep. I just helped my team to debug what was causing the issue.
Maybe I'll look into how the whole thing works once I've got a little more freetime on my hand. I can't promise anything but I'll keep it in mind; maybe someone in my team wants to look into that ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants