refactor(mcp) : update MCP tools to use ConstructeurLinks
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Mcp\Tool\Product;
|
||||
|
||||
use App\Entity\ProductConstructeurLink;
|
||||
use App\Mcp\Tool\McpToolHelper;
|
||||
use App\Repository\ConstructeurRepository;
|
||||
use App\Repository\ModelTypeRepository;
|
||||
@@ -71,15 +72,18 @@ class UpdateProductTool
|
||||
}
|
||||
|
||||
if (null !== $constructeurIds) {
|
||||
foreach ($product->getConstructeurs()->toArray() as $existing) {
|
||||
$product->removeConstructeur($existing);
|
||||
foreach ($product->getConstructeurLinks()->toArray() as $existing) {
|
||||
$this->em->remove($existing);
|
||||
}
|
||||
foreach ($constructeurIds as $cId) {
|
||||
$c = $this->constructeurs->find($cId);
|
||||
if (!$c) {
|
||||
$this->mcpError('not_found', "Constructeur not found: {$cId}");
|
||||
}
|
||||
$product->addConstructeur($c);
|
||||
$link = new ProductConstructeurLink();
|
||||
$link->setProduct($product);
|
||||
$link->setConstructeur($c);
|
||||
$this->em->persist($link);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user