Yes I assumed idpedido like a relation. I initialize my $model in my controller and I pass $model in render’s array and create/update array. The variable is filling because I have try “var_dump($model)”.
But when I want access the related table, for example, $model->pedido->produtopedido->idproduto. I have already define my relations on model pedido with produtopedido.
Does method above work or would work? I have been tried and at now, nothing!
I found the solution/problem. I have defined wrong relation(m:n). I have 3 tables: pedido, pedidoproduto and produto. I was defining relation between pedidoproduto and produto like HAS_MANY, where I would define BELONGS_TO. Now it works.