I have a resourve with some TV, in one TV i call a snippet [[!order-completed]]
in snippet [[!order-completed]] i have an array of data ($fields) and then:
$object = $modx->newObject('modResource');
$object->fromArray($fields);
$object->save();
when i tested if insert works .. i found that i get duplicated entries ... everytime this snippet is rendered i have two new same resources in database ... i first used xpdo to insert data so i thounght i done something wrong .. error log doesn’t give me nothing so after ->save i used file_put_contents(’test.txt’, time().’-’, FILE_APPEND);
everytime i display that resource test.txt gets two entries .. so that means the snippet is rendered twice .. time() gives me one sec delay between first and seccond insert .. i get 1302261875 1302261876 ... if all worked as it should then in text.txt should be only "1302261875"
what can be wrong? ...
i searched snippet name in DB to see if maybe is called twice somewhere .. i got two results .. one is in table where snippets are located .. and seccond in TV table where i call it ..