Saturday, October 2, 2010

I can't unbind a model

Then I have 3 models: Album, User, AlbumsUser linked together
Album has many AlbumsUser
User has many AlbumsUser
AlbumsUser belongs to Album, User

I have a function (in User controller) that paginate all results and
return me:
Array
(
[0] => Array
(
[AlbumsUser] => Array
(
[id] => 4ca71c13-22c64-4d5c-bda8-45ee248afdf92b
[0] => Array
(
[id] => 4ca349d7-
c394-4d5b-9f5b-40228afdf92b
[album_id] => f470c26b-0beb-44d0-
b49e-4caa02379b76
[user_id] => 4ca349c8-
d33c-4079-8574-4268118afdf92b
)

[1] => Array
(
[id] => 4ca71c13-2c624-4d5c-
bdada8-45248afdf92b
[album_id] => f470c26b-0beb-42d4d0-
b49e-4caa02379b76
[user_id] => 4ca311183d-8428-4722229-
b324-05b08afdf92b
)

)

[Album] => Array
(
[id] => f470c26b-0beb-44d0-b49e-4caa02379b76
[title] => Holiday in Italy
)
)
)

It's ok but I don't need AlbumsUser (indeed I really need just
AlbumsUser['id'] not AlbumsUser[0] and AlbumsUser[1]) how can I unbind
this from model?

I have try:
$this->User->AlbumsUser->unbindModel(array('hasMany' =>
array('AlbumsUser')), false);

but this doesn't works, any idea?

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: