07-29-2008, 04:07 AM
[eluser]Palino[/eluser]
[quote author="jTaby" date="1217294845"]Paul, If you go to RelationalContainer, chage the getAllForeignRecords function from:
To:
I haven't inspected or tried the code, but assuming it works, you'll be able to do this in your YAML file
[/quote]
this should help a little bit more:
and controller / definitions (im using PHP, sorry...):
[quote author="jTaby" date="1217294845"]Paul, If you go to RelationalContainer, chage the getAllForeignRecords function from:
Code:
$query = $this->CI->db->get($this->foreign_table);
return $query->result_array();
To:
Code:
$this->CI->db->from($this->foreign_table);
foreach($this->params['access_restriction'] as $k=>$v){
$this->CI->db->where($k,$v);
}
return $query->get()->result_array();
I haven't inspected or tried the code, but assuming it works, you'll be able to do this in your YAML file
Code:
second_table:
class: ManyToMany
params:
...
access_restriction:
field: value
this should help a little bit more:
Code:
$query = $this->CI->db->from($this->foreign_table);
if (isset($this->params['access_restriction'])) {
foreach($this->params['access_restriction'] as $k=>$v){
if (is_array($v)) {
$this->CI->db->where_in($k, $v);
} else {
$this->CI->db->where($k,$v);
}
}
}
return $query->get()->result_array();
and controller / definitions (im using PHP, sorry...):
Code:
...
'class' => 'ManyToMany',
'params' => array
(
'display_field' => 'name',
'access_restriction' => Array(
'language_id' => Array(0,1,2,3),
)
)
...