-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Added support for ObjectIds in fields other than _id & improved date casting #1523
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
Conversation
why Some checks were not successful ? please we need this feature asap can you check it +1 |
@jenssegers @Flambe What are the obstacles for this PR to be merged? Is there something we can do to help testing or additional work? |
@Djuki I'm pretty sure there are a few edge cases with the casting that I've missed. If you find any, I'll try and get them fixed, or you could make a PR on the repo for this PR. Otherwise I'm not sure what needs to be done. |
Did anyone manage to solve this? |
@bytewoopy We're still using this branch for our own usage of the library. We haven't been putting in an active effort to keep it ready to merge as we've had no feedback from the maintainers. Besides a few edge cases with casting, it's working as intended. |
@Flambe do you want merge this PR into stable release? |
@Smolevich I'd still like to get it merged, though it needs updating first and I haven't got around to that yet. |
Ok, ping if you resolve conflicts |
Will do, though it will likely be after the new year |
@Flambe laravel 7 has merged custom cast types ( see laravel/framework#31035 ), will it help without modifying much of code? @Smolevich what do you think? Thank you! |
Looks like as it can help, but needs to investigate |
I completely forgot about the conflicts, I'll try and get them done soon if I have some time! As Smolevich said, it'll need investigation if that'll help. Using that would also restrict us to Laravel 7 I believe. |
I myself will be waiting for this too so fingers crossed 🙏 . Thank you for your contribution! |
A improvement idea, use a const instead of |
@@ -480,4 +686,39 @@ public function __call($method, $parameters) | |||
|
|||
return parent::__call($method, $parameters); | |||
} | |||
|
|||
/** | |||
* @inheritdoc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fill params please in dock block
} | ||
|
||
/** | ||
* @inheritdoc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add dock block for $key
That's a freaking huge PR. I think it has to wait until a further stage of the package. |
Hi there, This feature will be released within next version. Closing for now. Thanks. |
Thank you @divine! Sorry for not getting to this sooner. |
I've extended the $casts property so that it's now possible to specify fields as 'objectid'. If you specify a field as 'objectid', it will be converted to one when you save/search for something.
Example syntax:
This PR also fixes issues with the $dates array not being followed when using dot notation.
This should solve #356 as you can now specify relationships in the $casts array. I decided not to make it the default behaviour for relationships as Mongo does not enforce relationship types, and as to not break backwards compatibility.
(other related issues: #134 #449 #350)