Php or Yii problem?

I don’t know why this happens.

Take a look:

This works


$telefone = $dadosPessoais->telefones[0];

$telefone->attributes = $dados['DadosPessoais']['Telefone'];

$telefone->Dados_Id   = $dadosPessoais->Id;

$telefone->Tipo_Id    = 1;

$telefone->TipoDados  = 1; // tipo Dado Pessoal

$telefone->save();[/code]

This doesn’t work


$dadosPessoais->telefones[0]->attributes = $dados['DadosPessoais']['Telefone'];

$dadosPessoais->telefones[0]->Dados_Id   = $dadosPessoais->Id;

$dadosPessoais->telefones[0]->Tipo_Id    = 1;

$dadosPessoais->telefones[0]->TipoDados  = 1; // tipo Dado Pessoal

$dadosPessoais->telefones[0]->save();

[color="#FF0000"]PHP Error

Descrição

Indirect modification of overloaded property DadosPessoais::$telefones has no effect[/color]

Any clues? :blink:

hello,

It is most likely a PHP thing, check this out: http://weierophinney.net/matthew/archives/131-Overloading-arrays-in-PHP-5.2.0.html

–iM

Thank you for the help.

This never happened to me before.