1. Use a callback function afterFind to loop the return array, remove the
empty item.2. How about give a condition when model->find.
[CODE]
'conditions' => array(("*not*" => array ( "Post.id" => *null* )), //array of
conditions
[/CODE]
On Tue, Aug 11, 2009 at 10:25 AM, Dave Maharaj :: WidePixels.com <
[email protected]> wrote:> > I have a contain query which produces these results. > > Basically the user bookmarked a page when they had access. The Owner of the > post has changed the level of who can view the Post so in this case this > user no longer can view the post hence the missing post data. It was not > grabbed because the conditions of the Post did not match the users access > level. > > But the bookmark still exists. Now in the query it pulls all bookmarks for > the user and the post related to the bookmark. How can I remove [1] from > the > array all together or all from the array if [Post] has no data? I can not > delete the bookmark when Posts change the access level because they may > change it back to a lower setting and allow those who did have it > bookmarked > to once again have access. I just need to remove the array entry(s) where > the Post array is empty. > > [0] => Array > ( > [Bookmark] => Array > ( > [id] => 38b7276f708 > [user_id] => 4a5d569f-b9e8-416d-b34c-11cf4adcd75b > [post_id] => 11e7ee > [created] => 2009-08-09 21:59:01 > ) > > [Post] => Array > ( > [title] => Test Title > [rank] => 2 > [created] => > [description] => Test dscription > [id] => 52louj > > ) > > ) > [1] => Array > ( > [Bookmark] => Array > ( > [id] => 38b7276f708 > [user_id] => 4a5d569f-b9e8-416d-b34c-11cf4adcd75b > [post_id] => 11e7ee > [created] => 2009-08-09 21:59:01 > ) > > [Post] => Array > ( > [title] => > [rank] => > [created] => > [description] => > [id] => > > ) > > ) > > Thanks, > > Dave > > > > > -- Thanks Joshua 5span.com <https://www.5span.com> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---
