craftcms / aws-s3

Amazon S3 volume type for Craft CMS.
https://plugins.craftcms.com/aws-s3
MIT License
61 stars 28 forks source link

Using isNew property to check for newly created model #129

Closed sijones-uk closed 3 years ago

sijones-uk commented 3 years ago

Description

Since Craft 3.7.5, the isNew property is no longer reliable when determining whether the entry is being saved for the first time. It is recommended to use the newly created (as of Craft 3.7.5) firstSave property instead.

Steps to reproduce

  1. Line 45 in the Plugin class uses the isNew property to check if the Asset model is newly created

Additional info

andris-sevcenko commented 3 years ago

Sorry for the previous comment, that was intended for a different issue 🤦

As far as this recommendation goes - it's only needed for element types that support drafts. Since assets don't support drafts (and unlikely will in any foreseeable future), using isNew is fine here.