Assign category through a plugin I am importing data into Craft. I happen to know that the id for my desired category is 22. The category is not being saved.

Here is my code.

    $entry = new EntryModel(); 
    $entry-&gt;sectionId   = 3; // 3 is Episode Section
    $entry-&gt;enabled     = true;
    $entry-&gt;authorId    = 1;
    $entry-&gt;slug = $slug;
    $entry-&gt;postDate = $postDate;
    $entry-&gt;getContent()-&gt;title = $title;
    $entry-&gt;getContent()-&gt;body = $body;
    $entry-&gt;getContent()-&gt;summary = $summary;
    $entry-&gt;getContent()-&gt;metaDescription = $summary;
    $entry-&gt;showName[] = 22;


Where showName is the category handle of my category field.
Okay, I think I figured it out. 1st, I added the getContent()

I changed

    $entry-&gt;showName[] = 22;


to 

    $entry-&gt;getContent()-&gt;showName = 22;


I think the problem is that the category we had set up only allowed for a single value and I was responding with an array.

Someone please correct me if am wrong.