Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Rest Bundle Doctrine Laravel Package

sdsdev/rest-bundle-doctrine

Doctrine integration for the SDS REST Bundle. It bridges REST resources with Doctrine ORM entities, repositories, and queries, simplifying persistence and data access for Symfony APIs and reducing boilerplate when building Doctrine-backed REST endpoints. Configure entity mapping and repository-backe...

View on GitHub
Deep Wiki
Context7

Getting Started

Install the package via Composer (consult the package README for the exact vendor/package name), then publish any configuration if required. Start by locating the entity base class or trait that provides many-to-many relationship handling—this is where 0.3.7’s fix lives.

First use case: define an entity with a many-to-many relation, then save related IDs as an array instead of loading models:

$entity->relatedEntities()->sync([1, 2, 3]);
// or, if the package exposes a custom save method:
$entity->saveManyToMany('relatedEntities', [1, 2, 3]);

Prior to 0.3.7, many-to-many saving on entities could fail or behave unpredictably. Upgrade to ^0.3.7 before relying on array-based saves.

Implementation Patterns

  • Array-based syncing – Prefer passing an array of IDs directly to the relationship save method. This avoids extra queries and is now explicitly supported.
  • Form handling – Validate incoming IDs as an array ('related_ids' => ['array'], 'related_ids.*' => ['integer', 'exists:related,id']), then pass the validated array straight to the entity save call.
  • Bulk imports/seeders – Use array saves in loops or batch operations to keep pivot tables in sync without hydrating models.
  • Eloquent interoperability – If your entities extend Eloquent models, standard sync()/attach() still work; the 0.3.7 change mainly benefits the package’s custom entity save path.
  • Testing – Assert pivot table rows after saving arrays to confirm the fix works in your environment; include a test that passes IDs as integers, not strings.
  • Integration tip – Wrap entity saves in transactions when syncing multiple relations so partial failures don’t leave orphaned pivot rows.

Gotchas and Tips

  • Version pinning – If you previously worked around broken many-to-many saves, remove those workarounds only after upgrading to >=0.3.7.
  • ID types – Pass scalar IDs (integers/strings). Passing model instances inside the array may not be supported by the custom save method; check the package’s type expectations.
  • Duplicate IDs – sync() deduplicates, but attach() may not. Prefer sync() when the array comes from user input.
  • Pivot attributes – The array-of-IDs convenience may not support extra pivot columns. If you need role, position, etc., use a keyed array ([1 => ['role' => 'admin']]) only if the package documents it; otherwise fall back to Eloquent’s syncWithPivotValues().
  • Debugging – Enable query logging and inspect the pivot table after a save. If 0.3.7 still fails, check whether the entity’s relation method name matches the array key you pass.
  • Extension points – Override the entity’s many-to-many save method in a subclass if you need custom pivot handling, and listen for model events (saved, created) to hook post-sync logic.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo