- 
                Notifications
    
You must be signed in to change notification settings  - Fork 2k
 
feat(entity): deep change tracking for objects and arrays #9779
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 4.7
Are you sure you want to change the base?
feat(entity): deep change tracking for objects and arrays #9779
Conversation
| 
           Nice. You can add JSON_UNESCAPED_UNICODE for readability? I'll test it later.  | 
    
          
  | 
    
          
  | 
    
          
 
 
  | 
    
| 
           I understand you, you stick to simplicity in many ways. I'm trying to expand possibilities by creating more complex solutions. It's not just about working with primitives. This is a better approach for a larger project than CRUD. 
 Casting converts it to primitives, so we can try using it in  A small clarification: is it normal to lose microseconds? I never work with them, so I'm just thinking ahead. https://www.php.net/manual/en/datetime.constants.php#constant.date-rfc3339-extended  | 
    
| 
           Good catch on the microseconds - fixed. I've also added support for native SPL iterators. Modern collection implementations already provide a  I don't believe casting is the right approach in this case, since we don't require casting to be explicitly defined.  | 
    
| 
           Sad. I think casting is similar to  Another case. Value Object (Phone, Address, Uuid...). They may not have an interface, but casting in CI4 for saving in the Model. or have the   | 
    
| 
           Casting in our Entity implementation should be used only when seeding it with data containing scalar values. In other cases, casting should not be used. Good call on   | 
    
| 
           Thanks, @michalsn for the huge PR. I don't have any questions right now. You need to use it to gain experience. For VO, i will have to add an interface for compatibility. I think this is not a bad option. Just to remind you, we have "nested relations" PR 😄 Maybe now it will be possible to combine it after the release of 4.7  | 
    
Description
This PR implements deep comparison for objects and arrays in
Entity::hasChanged()andEntity::syncOriginal().Previously, only shallow reference comparison was performed, meaning changes to object properties, array elements, or nested structures were not detected. This PR adds proper deep comparison using JSON normalization.
This may be considered a BC break, as existing applications that use objects within entities may now behave differently. For entities using only scalar types, there is no change in behavior.
Fixes #9777
Checklist: