-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Cast data before saving it into database and mongoId as Relationships #834
Conversation
setRelationCast add relation that ended with _id into objectId if config allow it
and use HasOneOrManyTrait
+1 it.. Nice job guy.. |
Can u add this in master please? |
+1 |
Tested this one, at this moment works great for me. @RTLer Thanks ! |
@jenssegers ignoring community pull requests is not an acceptable behavior.. |
@amiri27 It's on my todo list. There's quite some code to review. |
Well done @jenssegers ... Thanks a lot for your great library.. |
@jenssegers Some news? When this one be released? Cause I don't really want to change ObjectID relations to string. I need a fast workaround about this point. |
@jenssegers still no update after 1 month.. |
@jenssegers why not merged? |
@jenssegers any updates according this? |
@jenssegers do you have this update in your latest release |
There are breaking changes on master so unitTests are failing. would you please follow This steps to rebase this PR with master branch and running UnitTests against latest changes ? Thanks :) |
thx @pi0, i'm updated the branch with the latest changes on master and now all tests pass again, |
@@ -0,0 +1,46 @@ | |||
diff --git a/src/Jenssegers/Mongodb/Eloquent/Model.php b/src/Jenssegers/Mongodb/Eloquent/Model.php |
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.
Should not this diff patch file be excluded from commit ?
+1 for merge! |
@jenssegers can you merge these changes? |
Some changes may required before merge !? |
@jenssegers guy could you please respect to community by reply to them? still waiting to see any changes regarding this PR... |
it's been long time since i opened this PR, i think it's not going to merge, so i'm closing this PR. if anyone wants this functionality it can be found on "moloquent/moloquent" (it's based on jenssegers/laravel-mongodb but active!) |
@jenssegers any news? |
@jenssegers any news? I saw you updated the MIT license recently? but any others? |
@jenssegers Any update, I want to use ObjectIds as relations identifier as I am sharing database between multiple servers with multiple programming languages. having a problem that when we insert a document in mongo using this lib, it stores object id of other collection as a string. and other drivers in other languages uses ObjectIds to populate the document from relation. |
@umimehar Open this PR on https://github.com/rennokki/laravel-mongodb |
in this PR i modify the eloquent cast part to cast data before saving it into DB.
in project its difficult to cast data properly before saving it
i add $saveCasts into model that can be filled just $cast
mainly it use $saveCasts to cast Relationships into mongoId.
the mongoId as Relationships part can be activated by setting "use_mongo_id":
also this PR contains new test's for use_mongo_id part and some fixes to make it work with mongoIds