Is it obvious why the task validation errors are not getting output in my log:
public function runStep($step)
{
try
{
$entry = craft()->entries->getEntryById($this->_entryIds[$step], $this->_localeId);
if (!$entry)
{
return true;
}
$newExpiryDate = new DateTime($entry->date);
$newExpiryDate->add(new DateInterval('P1D'));
// Update Expiry Date
if($entry->expiryDate != $newExpiryDate)
{
$entry->expiryDate = $newExpiryDate->format('Y-m-d');
}
// Update Status
$entry->enabled = true;
// Save Entry
if(craft()->entries->saveEntry($entry))
{
return true;
}
else
{
$error = 'Encountered the following validation errors when trying to save entry with the ID "'.$entry->id.'":';
foreach ($entry->getAllErrors() as $attributeError)
{
$error .= "\n - {$attributeError}";
}
return $error;
}
return true;
}
catch (\Exception $e)
{
return 'An exception was thrown while trying to save the entry with the ID “'.$this->_entryIds[$step].'”: '.$e->getMessage();
}
}
This task step is based on one of the Craft default steps but the error gets output without the specific validation issues:
Encountered an error running task 1191 (Logic_UpdateEvents), step 1 of 1440: Encountered the following validation errors when trying to save entry with the ID "10295":
Craft::log('error count = '.count($entry->getAllErrors()));
error count = 1
Craft::log('error = '.$entry->getAllErrors[0]);
?Encountered an error running task 1193 (Logic_UpdateEvents), step 1 of 1440: An exception was thrown while trying to save the entry with the ID “10295”: Property "Craft\EntryModel.getAllErrors" is not defined.
Craft::log('error = '.$entry->getAllErrors()[0])
?