0

I'm making many-to many relatioships with categories and articles. But article must have "main" category, so in oters categories "rel="canonical"" to be placed. And logically to place it in join table. In Laravel there is wery simple mechanism to do so: http://laravel.com/docs/5.0/eloquent#working-with-pivot-tables

But I read about association mapping in Doctrine: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/association-mapping.html - and there is no info about how to access or modify that table. Is there any way to do this in Doctrine?

frenzy
  • 1,632
  • 3
  • 16
  • 18
  • possible duplicate of [Doctrine 2 and Many-to-many link table with an extra field](http://stackoverflow.com/questions/15616157/doctrine-2-and-many-to-many-link-table-with-an-extra-field) – Justin Howard May 11 '15 at 19:51
  • Well yeah, you right. But that was 2 years ago, does nothing changed? For now I see there is not conventional way: http://stackoverflow.com/questions/3542243/doctrine2-best-way-to-handle-many-to-many-with-extra-columns-in-reference-table So for now I see that there is no Laravel-like way to do this in Doctrine – frenzy May 11 '15 at 20:29
  • There is still no way to add a field to a many-to-many relationship in Doctrine. – Justin Howard May 11 '15 at 20:31

1 Answers1

1

At the point you are adding another field to the pivot table then it is no longer just a pivot table. You will need to create an entity to access the additional column as there is no way for doctrine to know what to accommodate in an optional 3rd column of a pivot table.

If you really need to access it then you can just create a raw doctrine query to access the table directly.

ShaneMit
  • 171
  • 1
  • 7