Right now, no.

I was just curious. Call it professional development.

I've been following the development of CakePHP 3, but have not had much
time to play with it directly. So I was curious about about the namespace
convention in CakePHP 3 applications, and what someone could do to ride
ahead of the migration curve if they happened to be using traits, a
construct where namespaces might become relevant.

On Friday, January 31, 2014, José Lorenzo <jose....@gmail.com> wrote:

> Do you need to use namespaces? Otherwise you can just load the file with
> App::uses()
>
> On Wednesday, January 29, 2014 11:50:52 AM UTC+1, Reuben wrote:
>>
>> Does using namespaces change anything?
>>
>> Or is the App::uses just to assist with loading the appropriate file?
>>
>> Keeping in mind CakePHP 3, if namespaces can be used, what would be the
>> namespace convention for a CakePHP 2 application?
>>
>> On Wednesday, January 29, 2014, José Lorenzo <jose...@gmail.com> wrote:
>>
>> Just load the trait with App::uses()
>>
>> On Tuesday, January 28, 2014 1:52:07 AM UTC+1, Reuben wrote:
>>
>> My original question on Stack Overflow [http://stackoverflow.com/ques
>> tions/21394852/whats-the-correct-method-for-using-traits-
>> and-namespaces-for-cakephp-2], and content copied here, should that
>> disappear.
>>
>> I'm using CakePHP 2.4.5 and PHP 5.5, and would like to use a trait.
>>
>> I have a trait in Utility/VariablesTrait.php called VariablesTrait.
>>
>> To take advantage of namespaces, I've given it a namespace of
>> App\Utility\VariablesTrait, since Utility\VariablesTrait seems a bit too
>> global, and the former would work better with CakePHP 3.
>>
>> In my class that I want to use it in, I have the use
>> App\Utility\VariablesTrait; statement in the class. For backup, I also
>> have a App::uses('VariablesTrait', 'Utility'); statement at the top of
>> the file. I'm not sure if the SPL autoloader is used when looking for
>> traits, which is why I was going for namespaces in the first place.
>>
>> The small issue is that the app directory is app, and since directory
>> structures should match namespaces (I think), I renamed it to App.
>> However, CakeRequest::_base() hardcodes app, so determining the
>> controller doesn't work so well.
>>
>> So, I'm trying to determine if that's a CakePHP bug, or if there is a
>> more appropriate way of using traits in CakePHP 2.
>>
>>
>>  --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "CakePHP" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/cake-php/gqWZW191sHU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> cake-php+unsubscr...@googlegroups.com<javascript:_e(%7B%7D,'cvml','cake-php%2bunsubscr...@googlegroups.com');>
> .
> To post to this group, send email to 
> cake-php@googlegroups.com<javascript:_e(%7B%7D,'cvml','cake-php@googlegroups.com');>
> .
> Visit this group at http://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to