-
Notifications
You must be signed in to change notification settings - Fork 35
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
Help with Models and namespaces #7
Comments
Got it working now. |
@rovillesarate Can you please post your solution? because it seems I've made a mistake regarding PSR figure. |
@rovillesarate Can you post your class namespace and the code from your loading.config.php file? Apparently, it's not psr-4 autoloading, but psr-0. It seems that I misunderstood the symfony api. Have you created extra folders to make your model class working? |
Yes. I also figure out that it is not using psr-4. return [ Its not working when i try to use it as so I end up removing the key in the loading config. I also found out that the model and controller file name should be the same with its class name or it wont be recognized. Plus i also forgot that my functions are not static functions so calling it by Class::function() wont work. |
I've just released framework 1.2.1 with appropriate fix to use psr-4 autoloading. Make sure to run a You should be able to use classes with or without namespaces correctly now. Thanks for reporting this. Regards, |
do i need to still edit the loading config file to be able to use namespace? |
What is the namespace for Page::make() ? use Themosis\Page; ? i am having problem with just the Page::make() If i remove it everything works fine. |
Got it working already. Its use Themosis\Facade\Page; |
If you want to namespace your custom classes, yes, you need to update your All core classes work base on a facade as you found. Basically the Page API class fullname is You can define custom aliases for your classes as well. For example, let's say you have a [
'MyTheme\\Models' => 'Pm'
] |
Hi! I am having issues running my models. I created a model called RegistrationModel and I want to call a function called init
when i call it via RegistrationModel::init() it says that RegistrationModel Class can not be found.
I edited the loading config file to
'MyTheme' => [themosis_path('theme').'controllers', themosis_path('theme').'models']
and added namespace in my class
namespace MyTheme\Models;
class RegistrationModel {
public function init() {
}
then try to use it in another file
use MyTheme\Models\RegistrationModel;
RegistrationModel::init();
I dont know what i am doing wrong. Hope you can guide me thanks!
The text was updated successfully, but these errors were encountered: