-
Notifications
You must be signed in to change notification settings - Fork 46
Add support set in fields stdClass in Structure::prepareToStore #173
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
Add support set in fields stdClass in Structure::prepareToStore #173
Conversation
@@ -399,6 +399,11 @@ public static function prepareToStore($value) | |||
return $value->toArray(); | |||
} | |||
|
|||
// stdClass | |||
if ($value instanceof \stdClass) { |
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.
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.
you broke tests
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.
i thought that was dejawoo but #143 there is already closed issue with same pull request )))
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.
@@ -399,6 +399,11 @@ public static function prepareToStore($value) | |||
return $value->toArray(); | |||
} | |||
|
|||
// stdClass | |||
if ($value instanceof \stdClass) { |
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.
i thought that was dejawoo but #143 there is already closed issue with same pull request )))
When i can get instruction for run docker? |
Hello,
I created a patch that adds the ability to save an empty object to the collection.
This need arose due to the nature of my system.
The save method in the class Document saves an empty object as an array.
Playback example:
I have Model Car extended Document.
Create $car = new Car();
$car->set('human-id', 1)->save();
$car->update(["human-id" => 1], ['$set' =>["markets-data.1" => ["car" => 1]]]);
Data in DB:
$car->update(["human-id" => 1], ['$unset' =>["markets-data.1" => ["car" => 1]]]);
Data in DB:
$car->save();
Data in DB:
Here is an example of how update works in the native view:
How to use my patch:
Create $car = new Car();
$car->set('human-id', 1)->save()
Data in DB:
$car->set('markets-data', new \stdClass)->save();
{
"_id" : ObjectId(""),
"markets-data" : {},
"human-id" : 1
}