I have a section of type channel with a matrix field. I want to know how I would save the matrix content while I save the entry as well. I know I can save the entry as follows:
$entry = new EntryModel();
$content = array('productName' => $data[0]['Product'][0], 'productQuantities' => $data[0]['Product'][1]);
$entry->sectionId = 10;
$entry->typeId = 10;
$entry->postDate = date('Y-m-d');
$entry->authorId = 1;
$result = $entry->setContentFromPost($content);
$entry->getContent()->title = "Fancy Title";
craft()->entries->saveEntry($entry);
The content variable above stores the content matrix block for this entry should have. So the Matrix has two fields within it one is of entry type and the other is numerical. I want to set these two fields before "craft()->entries->saveEntry($entry);". Please someone tell me how this is possible. I know for the entries type field I have to create a relation but please help me by letting me know how to do that as well as how to create this new matrix block containing that relation etc.