i have three tables
-
Profiles
i have two columns userid,login_name
-
Components
i have three columns id,name,initialowner
here initialowner points to Profiles->userid
for every component only one user will present.
-
Componentscc
i have two columns user_id,component_id
here userid points to Profiles->userid and component_id points to Components->id
for every user multiple components and for every component multiple users
i have models and relations on every table like below
class Profiles extends CActiveRecord
{
public function relations()
{
'initialowner' => array(self::HAS_MANY, 'Components', 'initialowner'),
'componentcc' => array(self::MANY_MANY, 'Components', 'component_cc(user_id, component_id)'),
}
}
class Components extends CActiveRecord
{
public function relations()
{
'initialowner' => array(self::HAS_MANY, 'Profiles', 'initialowner'),
}
}
class ComponentCc extends CActiveRecord
{
public function relations()
{
}
}
i need all the users from ComponentCc table of component_id(pass dynamic value $_POST[‘component_id’]) then join to Profiles table to get their userid,login_id to first result and i need all the users(need their userid,login_name) who are not part of the component to second result.
Could some one help me on this.