Set custom Hoa paths -> easy way?
1e1 opened this issue · comments
It should friendly create a method to redefine the main roots of the Hoa wrapper.
$hoa = Hoa\Core\Core::getInstance();
$hoa->getParameters()->setParameter('root.application', __DIR__);
$hoa->getParameters()->setParameter('root.data', __DIR__ . DS . 'Data');
$hoa->setProtocol();
What do you think about something like unresolve($data, $application=null, $hoa=null);
?
Hello :-),
What would be the semantics of unresolve
?
Sorry, my brain is off today.
I saw resolve
, so I think unresolve
.
Dynamically, I were say $hoa->setRoots($data, [$application=null, [$hoa=null]])
.
But a global function like resolved
deserves a discussion.
I need this action for one project.
You need it once but when starting, so this is important for the user experience. I agree that a function alias would be welcome, but not a global one. What about something like:
$core = Hoa\Core::getInstance();
$core->setApplicationRoot(…);
$core->setDataRoot(…);
$core->setLibraryRoot(…);
Maybe, an alternative would be:
$core = Hoa\Core::getInstance();
$core->setRoots(['application' => …, 'data' => …, 'library' => …]);
I don't like your proposal setRoots($data, $application, $library)
because the root names do not appear when reading the code.
I dislike the first option because each root setting calls Core->setProtocol()
.
If I'm wrong, the first option is easy understanding.
The second option is short and efficient.
Usually we are setting up the roots once per project, well the call can be "technical" (grow up the code complexity in the statement).
Who writes it? :p
You're right. The first proposal, with set*Root
methods, will call the setProtocol
method each time, which is bad. So we are agree for the setRoots(Array)
proposal?
Yeap!
Sure!
@1e1 If this issue is still valid with the Hoa\Protocol
library, please, reopen it there.