Orphan articles

Cake 3.4
Articles belongTo Categories
Users can delete categories so, sometimes, articles no longer belong to any category.
How can I find all orphan articles ?
I tried :
$categories = $this->Articles->Categories->find()
->select(‘Categories.id’, ‘Categories.name’)
then :
$query = $this->Articles->find()
->select([‘Articles.id’, ‘Articles.category_id’, ‘Articles.name’, ‘Articles.published’])
->where([‘Articles.category_id not in’ => $categories])
->order([‘Articles.name’ => ‘ASC’])

but it does not work.

Fix that and set a foreign key constraint so they can’t do that.

To fix probably export everything set up a routine to re-import and check child-parent relationship existing.

After fixing have it to where they have to delete children before parent, or write the code that takes care of it in the background.

In a relational database things have to happen in the background for proper maintenance.

Thank you for your answer.
In fact, I need to do this in pre prod mode because the webmaster of my client is not sure of the site map he wants and he tries different options.
Of course, this will not be possible in production mode.

In fact, my problem was with this line :
as there is of course no category to be contained !

Thank you again.

Much easier answer:

So simple !!!

Thank you very very much