Closed beeards closed 11 months ago
Hi @beeards, you can try this package!
Hi @SanaviaNicolas, your package looks good!
But I'm trying to update embedded models with jenssegers/laravel-mongodb package. It's supposed to uses exactly the same methods as original Laravel classes.
Hi @beeards, this package has some bugs on embeds relationships and they no longer be maintained. Laravel Mongo Auto Sync provides a better support for MongoDB relationships and all the methods are based on eloquent methods. Check our documentation.
Hi @SanaviaNicolas! I just migrated all to mysql, because I found out, and it seems that it will not be maintained (in short-mid term? 🤷), as you said.
* I've been reading the documentation and reviewing the code of Laravel Mongo Auto Sync and looks good, it has a lot of work behind, I will keep it in mind for other projects. IMO maybe some files need a revision (e.g.: Traits/ModelAdditionalMethod.php), I guess it's because it's being used in other projects.
@GromNaN According to the tests, it is fixed now.
Description:
EmbedsOne Relationship do not save / create / update in db. Tested all the methods in README.md #embedsone-relationship or have I missed something.
Steps to reproduce
Expected behaviour
Save in db and get embebed one data.
Actual behaviour
Do not save in db and can't get embebed one data.
Logs:
```txt • Tests\SeederTest > that inserts and updates an embeds one Failed asserting that null matches expected 'street, 1'. at tests/SeederTest.php:67 63▕ $stored_supplier = Supplier::first(); 64▕ 65▕ $this->assertEquals( 66▕ $data_source['address']['streetAddress'], ➜ 67▕ $stored_supplier->address()->streetAddress 68▕ ); 69▕ } 70▕ 71▕ public function test_that_inserts_and_updates_similiar_an_embeds_one() • Tests\SeederTest > that inserts and updates similiar an embeds one MongoDB\Driver\Exception\BulkWriteException E11000 duplicate key error collection: foo.suppliers index: name_1 dup key: { name: null } at vendor/mongodb/mongodb/src/Operation/InsertOne.php:123 119▕ 120▕ $bulk = new Bulk($this->createBulkWriteOptions()); 121▕ $insertedId = $bulk->insert($this->document); 122▕ ➜ 123▕ $writeResult = $server->executeBulkWrite($this->databaseName . '.' . $this->collectionName, $bulk, $this->createExecuteOptions()); 124▕ 125▕ return new InsertOneResult($writeResult, $insertedId); 126▕ } 127▕ +16 vendor frames 17 tests/SeederTest.php:118 Jenssegers\Mongodb\Eloquent\Model::__call("create") • Tests\SeederTest > that updates an embeds one LogicException App\Models\Supplier::address must return a relationship instance. at vendor/illuminate/database/Eloquent/Concerns/HasAttributes.php:549 545▕ '%s::%s must return a relationship instance, but "null" was returned. Was the "return" keyword used?', static::class, $method 546▕ )); 547▕ } 548▕ ➜ 549▕ throw new LogicException(sprintf( 550▕ '%s::%s must return a relationship instance.', static::class, $method 551▕ )); 552▕ } 553▕ +3 vendor frames 4 tests/SeederTest.php:177 Illuminate\Database\Eloquent\Model::__get("address") ```