ManyToMany self referencing and exceeded number of join relations exception
See original GitHub issueHi,
First of all, big thanks for api-platform it’s amazing.
I have the Campaign resource:
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* A campaign.
*
* @ORM\Entity()
*/
class Campaign
{
/**
* @Groups({"campaign_list", "campaign_get"})
*
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @Groups({"campaign_list", "campaign_get"})
*
* @ORM\Column
*/
private $name;
/**
* @Groups({"campaign_get"})
*
* @ORM\ManyToMany(targetEntity="AppBundle\Entity\Campaign")
*/
private $excluded;
}
When I try to GET /campaigns I get this exception:
The total number of joined relations has exceeded the specified maximum. Raise the limit if necessary.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:12 (12 by maintainers)
Top Results From Across the Web
Doctrine2 ManyToMany Self referencing - Stack Overflow
I got problems with persisting many to many self referencing relations. I receive error: The class 'Doctrine\ORM\Persisters\ManyToManyPersister' was not ...
Read more >Create a many-to-many relationship
Many-to-Many table names cannot exceed 30 characters. Reference default many-to-many relationships. Some many-to-many relationships are ...
Read more >Web service error codes (Microsoft Dataverse) - Power Apps
Message: Relationship for polymorphic lookup cannot be self referential. The entity '{0}' cannot be the referencing and referenced entity.
Read more >SQLObject 3.10.0 documentation
SQLObject has joins, one-to-many, and many-to-many, something which many ORMs do not have. The join system is also intended to be extensible.
Read more >Solving 5 Mysterious Spark Errors | by yhoztak - Medium
Exception in thread "main" org.apache.spark.sql. ... Also if you don't have null, your many to many join is creating too many rows. Make...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Indeed, you have a recursive relation here, where campaign is referencing itself. You may want to disable eager loading here by using
@ApiResource(attributes={"force_eager"=false})
.@clementtalleu I didn’t have to change enythink, becasue @Simperfit pull request resolves my issue, which version of api platform do you have?