- 🇨🇦Canada Nathan Tsai
Crossposting from https://www.drupal.org/project/feeds/issues/3337811#comment-15145862: 🐛 Argument #1 ($value) must be of type Countable|array, null given in FeedsProcessor->clean() Fixed
If looking for a work around so that feeds will unpublish missing nodes even when the response is empty...
Set your importer to include the published status.
Then use the following code to ensure there's always at least one node in your response.
...I did not realize that feeds do not import nodes when the response is empty or there are no items.
For future reference, I added the following code for my REST Export to ensure there is always at least one item in my response.
use Drupal\views\ViewExecutable; use Drupal\views\ResultRow; use Drupal\node\Entity\Node; /** * Implements hook_views_post_execute(). */ function HOOK_views_post_execute(ViewExecutable $view) { if ($view->id() == 'MY_VIEW_ID') { // Feeds does not import an empty response. Therefore, add a // dummy feeds item if ($view->total_rows === 0) { $dummyNode = Node::create([ 'type' => 'job_posting', 'nid' => -1, // Our GUID. This is valid because we never save the node 'title' => 'PLACEHOLDER NODE', 'status' => 0, // Be unpublished, so it doesn't appear on the importing website ]); $view->result[] = new ResultRow([ '_entity' => $dummyNode, ]); } } }