[eluser]GDmac - expocom[/eluser]
i begin to grasp yml, but 4 spaces wrong and and a param has gone one level down
suddenly i feel old, takes me some time to dive into code again.
on a side-note: spyc / yaml needs tab-support drastically
--
jTaby here is a small edit for the OneToMany plugin, where you can now
set which column for the other table that has this table's primary keys.
Local_table.'id' was hardcoded, i added remote_key to yml parsing. YML
Code:
other_table:
class: OneToMany
params:
display_field: name
table_fields: name, description
primary_key: primary_from_other_table
remote_key: other_table_column_pointing_here
in the plugin i replaced all hardcoded $this->local_table.'_id' with $this->remote_key
and added $remote_key to the vars. In the constructor added:
Code:
if(isset($this->params['remote_key'])){
$this->remote_key = $this->params['remote_key'];
}else{
$this->remote_key = $this->local_table.'_id';
}
Also: currently the constructor checks primary_key as a first-level param. if you want primary_key to be a param for OneToMany (and under params as in the yml-example above) then in the constructor:
Code:
$this->primary_key = (isset($params['primary_key']))? $params['primary_key'] : 'id';
should be:
$this->primary_key = (isset($params['params']['primary_key']))? $params['params']['primary_key'] : 'id';