Hi,

I try to use the following method to develop the CRUD when involve two
tables or more:

                $this->Product-
>unbindModel(array('hasOne'=>array('ProductDetail')));
                $this->Product->bindModel(array('hasOne'=>array(
                                'ProductDetail'=>array(
                                        'foreignKey'=>false,
                                        
'conditions'=>array('ProductDetail.product_id=Product.id')
                                )
                )

But i found out the result will add an extra level, the [0]:
Array
(
    [0] => Array
        (
            [Product] => Array
                (
                    [id] => 1
                    [stock_code] =>
                    [short_name] => xxx

                )

            [ProductDetail] => Array
                (
                    [id] => 1
                    [product_id] => 1
                    [description] => YYYYYY

                )

        )

)


When we use $this->Product->read();
it will generate only (without the [0] level)
Array
(
            [Product] => Array
                (
                    [id] => 1
                    [stock_code] =>
                    [short_name] => xxx

                )

            [ProductDetail] => Array
                (
                    [id] => 1
                    [product_id] => 1
                    [description] => YYYYYY

                )
)

Due to this problem, i have to change all my edit/add forms (a lot) .
Is there any way to minimise the change? The relationship of these
tables is OneToOne.

Thanks.

Best Regards.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to