A
A
Alexander Shirobokov2014-07-08 12:09:06
Yii
Alexander Shirobokov, 2014-07-08 12:09:06

How to import classes in Yii2?

Inside the project, there is a set of classes in the api directory with corresponding namespaces like api\..\ .
When you try to call a static method of a class in a console controller with a connected namespace, an Exception is thrown with a message that the called class does not exist.
In Yii1, this was solved by prescribing the desired directory in the import section of the config file.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2014-07-08
@konrin

Read about psr0 autoload, maybe your file path does not match the namespace

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question