<p>It's because the ResaveElements task calls <code>craft()-&gt;elements-&gt;saveElement()</code> directly, instead of going through the element specific save method (like <code>craft()-&gt;entries-&gt;saveEntry()</code>.</p>

<p>You'll want to listen to the <a href="https://craftcms.com/docs/plugins/events-reference#elements-onSaveElement" rel="nofollow noreferrer">onSaveElement</a> event, check that it's an Entry you're looking at, then perform any specific business logic that you need.</p>

CC BY-SA 3.0
2017-06-01T01:44:23.813Z
2017-06-01T01:44:23.813Z
Brad Bell
<p>I've got a plugin that does a thing when an entry is resaved. It works great. However I need it to fire for every single entry to build some data.</p>

<pre><code>craft()-&gt;on('entries.saveEntry', function(Event $event) {
    // Do the thing
});
</code></pre>

<p>Why does running a <strong>ResaveElements</strong> task not fire this yet saving an entry does? Updating a section to cause all of the entries in that section to update doesn't either.</p>

<p>Is there a way I can bulk trigger this to fire outside of me having to write my own script to manually do it.</p>

<p>Thanks!</p>

<plugin-development><elementcriteriamodel><performance><events>
entries.saveEntry not triggered by ResaveElements task
# entries.saveEntry not triggered by ResaveElements task

(Asked by: username_0 on 2017-06-01)

I've got a plugin that does a thing when an entry is resaved. It works great. However I need it to fire for every single entry to build some data.
craft()->on('entries.saveEntry', function(Event $event) {
    // Do the thing
});

Why does running a ResaveElements task not fire this yet saving an entry does? Updating a section to cause all of the entries in that section to update doesn't either.
Is there a way I can bulk trigger this to fire outside of me having to write my own script to manually do it.
Thanks!

**Tags:** plugin-development, elementcriteriamodel, performance, events


---

## 1 answers

### Answer by username_1 on 2017-06-01. Score: 2 | Accepted answer

It's because the ResaveElements task calls `craft()->elements->saveElement()` directly, instead of going through the element specific save method (like `craft()->entries->saveEntry()`.

You'll want to listen to the [onSaveElement](https://craftcms.com/docs/plugins/events-reference#elements-onSaveElement) event, check that it's an Entry you're looking at, then perform any specific business logic that you need.


---

