Re: Test Suite v1.2: $useDbConfig problem in model association.

2008-04-17 Thread Defranco

Should I report the fact that $model->setDataSource($dbConfig) do not
affect related models as a bug or as an enhancement?

Actually, if I set

$model->setDataSource('test_suite');

Related model like $model->Model2 will still have  $dbConfig='default'
not $dbConfig='test_suite' as the main model - what looks don't make
sense.

Maybe it should instantiate a new Model2 with $dbConfig='test_suite'
instead of keeping relations of models between databases.

Is it a bug or should report only as an enhancement?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Test Suite v1.2: $useDbConfig problem in model association.

2008-04-10 Thread releod

thanks for posting that - I was running into the same problems, all is
well now. According to the passing tests :)

On Mar 20, 5:20 pm, Defranco <[EMAIL PROTECTED]> wrote:
> Hi again,
>
> Please discard the code from previous post, it has a lot of bugs.
>
> This is working better:
>
> __
> //app_model.php:
>
> function __construct($id = false, $table = null, $ds = null){
>
> parent::__construct($id, $table, $ds);
>
> //This need to be placed after parent::__construct();
> $_dbConfig_test = 'test_suite';
> if ( $this->useDbConfig == $_dbConfig_test)
> $this->setDataSource_recursively($_dbConfig_test);
> }
>
> function setDataSource_recursively ($dbConfig, $recursive = 5){
>
> $sub_models = array();
>
> if ($this->useDbConfig !== $dbConfig)
> $this->setDataSource($dbConfig);
>
> if ($recursive >= 0){
> foreach ($this->tableToModel as $tableToModel)
> $sub_models[] = $tableToModel;
>
> foreach ( $sub_models as $model){
>
> if (isset($this->{$model})){
> 
> $this->{$model}->setDataSource_recursively($dbConfig, --
> $recursive);
> }
> }
> }
> }
> _
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---