public function filterMemberIdByProfileOption($ids, $column, $value, ProfileOption $item, $publicFlag = 1) { $_result = array(); $q = Doctrine::getTable('MemberProfile')->createQuery('m')->select('m.member_id')->where('m.' . $column . '= ?', $value)->andWhere('m.profile_option_id = ?', $item->getId()); if (is_integer($publicFlag)) { $q->addFrom('MemberProfile pm')->andWhere('m.tree_key = pm.id')->andWhere('pm.public_flag <= ?', $publicFlag); } $list = $q->execute(); foreach ($list as $value) { $_result[] = $value->getMemberId(); } if (is_array($ids)) { $ids = array_values(array_intersect($ids, $_result)); } else { $ids = array_values($_result); } return $ids; }