Namespaces "use" php - general Qustion
Permalink
Example: autoNav block ------ controller.php
Why i need for example the "use core;" - inside autoNav controller.php? Someone tell me more about this issue.
use core; use Database; use Page; //rest of the code
Why i need for example the "use core;" - inside autoNav controller.php? Someone tell me more about this issue.
Thanks :)
Question 1:
I dont understand how i know when i need to use "USE" and when not. use its like "import" for SRC functions? Can you tell me in simple words the idea her?
Question 2:
This is OOP idea?...And/Or PHP core feature (I can read about this in PHP docs)
Question 3 - Short VS long url.
Inside pageList controller:
One time its look like this (Concret/folder/sub-folder.....full url):
use Concrete\Core\Attribute\Key\CollectionKey;
And one time its only "one word":
use Core;
What the difference?
Question 1:
I dont understand how i know when i need to use "USE" and when not. use its like "import" for SRC functions? Can you tell me in simple words the idea her?
Question 2:
This is OOP idea?...And/Or PHP core feature (I can read about this in PHP docs)
Question 3 - Short VS long url.
Inside pageList controller:
use BlockType; // short use CollectionAttributeKey; // short use Concrete\Core\Block\BlockController; // long use Concrete\Core\Page\Feed; // long use Database; // short use Page; // short use Core; // short use PageList; // short use Concrete\Core\Attribute\Key\CollectionKey; // long use Concrete\Core\Tree\Node\Type\Topic; // long
One time its look like this (Concret/folder/sub-folder.....full url):
use Concrete\Core\Attribute\Key\CollectionKey;
And one time its only "one word":
use Core;
What the difference?
This isn't something specific to concrete5, but is a php feature. Documentation is athttp://php.net/manual/en/language.namespaces.importing.php... .
@siton
In addition to the link Gondwana included, some of the classes are facades and aliases.
Aliases:
https://github.com/concrete5/concrete5/blob/develop/web/concrete/con...
Facades:
https://github.com/concrete5/concrete5/blob/develop/web/concrete/con...
Additional information:
https://www.youtube.com/watch?v=FjJJUrggPM0...
http://www.concrete5.org/community/forums/5-7-discussion/namespace-...
In addition to the link Gondwana included, some of the classes are facades and aliases.
Aliases:
https://github.com/concrete5/concrete5/blob/develop/web/concrete/con...
Facades:
https://github.com/concrete5/concrete5/blob/develop/web/concrete/con...
Additional information:
https://www.youtube.com/watch?v=FjJJUrggPM0...
http://www.concrete5.org/community/forums/5-7-discussion/namespace-...
Core is required to use these services:
https://github.com/concrete5/concrete5/blob/develop/web/concrete/blo...
https://github.com/concrete5/concrete5/blob/develop/web/concrete/blo...
https://github.com/concrete5/concrete5/blob/develop/web/concrete/blo...
https://github.com/concrete5/concrete5/blob/develop/web/concrete/blo...
https://github.com/concrete5/concrete5/blob/develop/web/concrete/blo...
A discussion about services:
http://www.concrete5.org/community/forums/5-7-discussion/helpers/...
Core is a facade:
https://github.com/concrete5/concrete5/blob/develop/web/concrete/con...
A facade for:
https://github.com/concrete5/concrete5/blob/develop/web/concrete/src...
Which extends Facade:
https://github.com/concrete5/concrete5/blob/develop/web/concrete/src...
Some information about Facades:
https://laravel.com/docs/4.2/facades...