Skip to main content
edited body
Source Link
Brad Bell
  • 67.6k
  • 6
  • 75
  • 145

The EntryModel you have has a sectionId property you can set. i.e.

 $entry = new EntryModel();
 $entry->sectionId = 1;
 $saveIt = craft()->entries->saveEntry($entry);

Note that there are other properties you'll need to set for it to pass validation. So if, if $saveIt is false after calling saveEntry($entry), then call $entry->getErrors() to get an array of validation errors to fix.

The EntryModel you have has a sectionId property you can set. i.e.

 $entry = new EntryModel();
 $entry->sectionId = 1;
 $saveIt = craft()->entries->saveEntry($entry);

Note that there are other properties you'll need to set for it to pass validation. So if, $saveIt is false after calling saveEntry($entry), then call $entry->getErrors() to get an array of validation errors to fix.

The EntryModel you have has a sectionId property you can set. i.e.

 $entry = new EntryModel();
 $entry->sectionId = 1;
 $saveIt = craft()->entries->saveEntry($entry);

Note that there are other properties you'll need to set for it to pass validation. So, if $saveIt is false after calling saveEntry($entry), then call $entry->getErrors() to get an array of validation errors to fix.

Source Link
Brad Bell
  • 67.6k
  • 6
  • 75
  • 145

The EntryModel you have has a sectionId property you can set. i.e.

 $entry = new EntryModel();
 $entry->sectionId = 1;
 $saveIt = craft()->entries->saveEntry($entry);

Note that there are other properties you'll need to set for it to pass validation. So if, $saveIt is false after calling saveEntry($entry), then call $entry->getErrors() to get an array of validation errors to fix.