-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Accessing relation in model causes dirty state to change to transient #11042
Comments
I'm not sure how can this work: $child = Child::find(); // this returns a resultset
echo "Initial state: {$child ->getDirtyState()} <br />";
$parent = $child ->relatedparent; // you can't do this |
What's the problem, I'm grabbing the related parent of the child...? On Thu, Oct 29, 2015 at 12:27 PM, Andy Gutierrez [email protected]
|
Child::find() returns a resultset you can't access the related parent on a resultset. |
Oh, I see what you're saying...it's a mistake in the code. Just assume there's a foreach loop there and this is done on one of the actual models...sorry it was pseudo-code |
Should be clearer now, I updated the code |
Btw, is there any reason the dirty state should change if the property is being set to an object? That itself also doesn't make sense to me...this record is in the database and is going to be updated, why should it be in TRANSIENT state? Setting any other property on the record doesn't change the dirty state... |
#11042 - Fix setting relation should not always cause dirty state change
This is fixed by PR #11055 |
Code:
Is this by design? If so, why? This is causing us big headaches in our application, so any help would be appreciated.
The text was updated successfully, but these errors were encountered: