Hi, im looking for something similar as Laravel Sync but in Phalcon, for example:

ARTICLES

  • ID
  • Title

CATEGORIES

  • ID
  • Title

ARTICLES_CATEGORIES

  • ID
  • Article_ID
  • Categorie_ID

-

$article = Articles::findFirstById($id);

// IT WILL ADD OR KEEP CATEGORIES, 1,5, AND WILL REMOVE OTHER CATEGORIES IF IT HAS OTHERS

$article->categories->sync([1,5]);

$article->save();

Is there any way to do this on Phalcon, thanks.