When i execute this code...it doesn’t work. It inserts tmplvarid 0 and templateid 0
or it inserts nothing (because 0, 0, 0 already exists) and gives me the return value "false"
update: when i add rank => 5 to the query it DOES save rank 5 in the database but still
tmplvarid 0 and templateid 0...how is this possible? We are running RC3 (7083)
update2: Why does the table (site_tmplvar_templates) have 2 primary keys?
$templateLink = $this->modx->newObject('modTemplateVarTemplate');
$templateLink->fromArray(array(
'tmplvarid' => 1,
'templateid' => 4,
'rank' => 5
));
$templateLink->save();
I cannot wrap my head around this...this is the most plain query one can
execute right?
edit:
For the next person viewing this...this SHOULD work:
$templateLink = $this->modx->newObject('modTemplateVarTemplate');
$templateLink->fromArray(array(
'tmplvarid' => 1,
'templateid' => 4,
'rank' => 5
), '', true); // by true you say it's ok to write/overwrite primary keys
$templateLink->save();