Problem saving new entry populated with setContentFromPost() while setContent() works I'm building a cinema program, and I'm trying to build entries for movies and shows loading external data via a plugin.

I'm getting close, but now I've hit a roadblock trying to save the entries. I build an array of the data to set as content that looks something like this:

$movie = [
  'movieID'       =&gt; (int)$ctx_movie['MOVIE_ID'],
  'title'         =&gt; $ctx_movie['VERANSTALTUNGSTITEL'],
  'audioLanguage' =&gt; $ctx_movie['SPRACHVERSION'],
  'country'       =&gt; $ctx_movie['COUNTRY'],
  'director'      =&gt; $ctx_movie['DIRECTOR']
]


Then I make an entry model, and try to set the content to the above array:

$entry = new EntryModel();
$entry-&gt;sectionId = craft()-&gt;sections-&gt;getSectionByHandle('movies')-&gt;id;
$entry-&gt;typeId    = craft()-&gt;sections-&gt;getSectionByHandle('movies')-&gt;type('movie')-&gt;id;
$entry-&gt;authorId  = craft()-&gt;userSession-&gt;getUser()-&gt;id;
$entry-&gt;enabled   = true;

// This doesn't work:
$entry-&gt;setContentFromPost($movie);

// This seems to work, creating an entry and populating fields:
// $entry-&gt;setContent($movie);

$success = craft()-&gt;entries-&gt;saveEntry($entry);


I keep getting this error for every entry:

array ( 'title' =&gt; array ( 0 =&gt; 'Name cannot be blank.', ), )


The value I set to the 'title' element definitely has a value, and even if I hard code it to be a dummy string, it still fails in the same way.

It seems to work when using setContent($movie) instead of setContentFromPost($movie), but from what I've read the latter is the correct (or best practice) way to do it.

I'm guessing it has something to do with the extra validation, but I can't for the life of me understand why a simple string like 'Dummy title' fails the same way as my variable. The name setContentFromPost throws me off a bit, as I'm unsure if it means the data should come via a post request, but it seems to be fine with my other variables, and from the documentation they seem to be used in the same way, passing an array of values.

(On a side note, I got a similar error for a field that is of type dropdown. I guess here I just haven't understood what value to pass to a dropdown fieldType, so if someone has any tips here too, that would also be great, but I assume it may be two different issues.)
I believe that setContentFromPost can only be used to set the content of custom fields on an EntryModel, not standard fields such as title.

Instead, you need to use $entry-&gt;getContent()-&gt;title to set the title on the EntryModel.

So your code would look like this:

$movie = [
  'movieID'       =&gt; (int)$ctx_movie['MOVIE_ID'],
  'audioLanguage' =&gt; $ctx_movie['SPRACHVERSION'],
  'country'       =&gt; $ctx_movie['COUNTRY'],
  'director'      =&gt; $ctx_movie['DIRECTOR']
];

$entry = new EntryModel();
$entry-&gt;sectionId = craft()-&gt;sections-&gt;getSectionByHandle('movies')-&gt;id;
$entry-&gt;typeId    = craft()-&gt;sections-&gt;getSectionByHandle('movies')-&gt;type('movie')-&gt;id;
$entry-&gt;authorId  = craft()-&gt;userSession-&gt;getUser()-&gt;id;
$entry-&gt;enabled   = true;

// Set the title directly on the $entry
$entry-&gt;getContent()-&gt;title = $ctx_movie['VERANSTALTUNGSTITEL'];

// This should now work:
$entry-&gt;setContentFromPost($movie);

$success = craft()-&gt;entries-&gt;saveEntry($entry);