gabordemooij / redbean

ORM layer that creates models, config and database on the fly
https://www.redbeanphp.com
2.3k stars 279 forks source link

Best way to link to self? #942

Open Josh5A opened 1 month ago

Josh5A commented 1 month ago

Hello,

I'm not sure where to ask this question. Can RedBean do many-to-many self references? I have a table of articles and I need to record which ones will link to others internally.

So I want to be able to do something like $article→sharedArticleList.

In the database, the table I want is: CREATE TABLE article_article ( article_id1 INT NOT NULL, article_id2 INT NOT NULL, PRIMARY KEY(article_id1, article_id2) );

Lynesth commented 1 month ago

You should be able to do it as you'd do any other shared lists.