Yii Framework Forum: 多对多关系取值问题 - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

多对多关系取值问题 Rate Topic: -----

#1 User is offline   caihua 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 08-February 13

Posted 08 February 2013 - 02:43 AM

比方说post和category
1个post包括多个category
1个category包括多个post

我想取1个post ,而这个post的所有category都不包含id为10 的category 怎么取?

我之前用了 $posts=Post::model()->with(array ('categorys' => array(condition => 'id!= 10')) )->findAll();

这样取到的post仔细一看,在关联表中 数据不正确,貌似应该用sql的 not in?
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users