I am stuck on saving entry with a category field. The error message I get is about not being able to create/update the entry in the relations table.
$accomodationTypecategory = ['title'=>'Hotel']
$entry = new EntryModel();
$entry->sectionId = 3;
$entry->typeId = 3;
$entry->authorId = 1;
$entry->enabled = true;
$entry->setContent(
$entry->getContent()->setAttributes([
'title' => 'Test Entry',
'body' => "Testing",
'address'=>"101 Silver Avenue",
'phone'=>'0209900292092',
'websiteAddress'=>'www.example.com',
'towns'=>'Newy',
'accommodationType'=>$accomodationTypecategory
]);
craft()->entries->saveEntry($entry);
Any help will be appreciated.