tonydspaniard / yiinitializr-intermediate

Yii Framework project structure boilerplate for basic to intermediate application requirements
22 stars 14 forks source link

Fix application init #8

Closed ifdattic closed 11 years ago

ifdattic commented 11 years ago

Related to 2amigos/yiinitializr#6

tonydspaniard commented 11 years ago

Thanks!

ifdattic commented 11 years ago

Glad to help. If I find anything else I can contribute I will send a PR.

On the side note there is still a small problem with this change. It's great that now configuration works as it's supposed to work, but the problem is that now you can't use Yii variables in the configuration.

tonydspaniard commented 11 years ago

Why not?

Check Yiinitializr params and how they set regular Yii const Enviado desde mi BlackBerry® de Vodafone

-----Original Message----- From: "Andrew M." notifications@github.com Date: Tue, 28 May 2013 13:33:31 To: tonydspaniard/yiinitializr-intermediateyiinitializr-intermediate@noreply.github.com Reply-To: tonydspaniard/yiinitializr-intermediate reply@reply.github.com Cc: Antonio Ramirezantonio@ramirezcobos.com Subject: Re: [yiinitializr-intermediate] Fix application init (#8)

Glad to help. If I find anything else I can contribute I will send a PR.

On the side note there is still a small problem with this change. It's great that now configuration works as it's supposed to work, but the problem is that now you can't use Yii variables in the configuration.


Reply to this email directly or view it on GitHub: https://github.com/tonydspaniard/yiinitializr-intermediate/pull/8#issuecomment-18578037

ifdattic commented 11 years ago

Couldn't find that I was looking for, or I'm just missing something. Of course I should have explained better that I meant.

Using the default application, or Yiinitializr old init code, you could write your configuration file like the following:

'widgetFactory' => array(
  'widgets' => array(
    // CActiveDataProvider
    'CActiveDataProvider' => array(
      'sort' => array(
        'defaultOrder' => array(
          't.publish_on' => CSort::SORT_DESC,
        ),
      ),
    'pagination' => array(
      'pageSize' => 100,
    ),
  ),
),

Now because Yii is included after you get your configuration, you will get a fatal error because the CSort class is not found. This result is expected as we don't have Yii and its autoloader, and I might be overlooking something important, but it would be nice to use class constants in configuration without having to use its value (which might lead to additional problems in the future).