Select the records that have not been translated


I am currently working on a project with version 3.7 of CakePHP.

In this project I use Google Cloud Translation API to automatically translate some information into multiple languages.

The information to be translated is retrieved from an external database and before saving this information, it is translated.
Some times The Google Cloud Translation API returns a NULL result and to not block the import of data we record the information without translation.

I would like to know if it is possible in CakePHP to select recordings that have no translation and/or are not translated into some languages?

Thank you for your help and sorry for my english.

So, you want to know if you can do a query that returns records where the translation field is null?


Yes, I’m trying to find out how to make a request to display translations with fields is NULL.

Thank you.

Have you written any queries at all in CakePHP? If not, you should look at the documentation and tutorials to learn this very basic knowledge. If you have written queries, then this is just like any other, your condition would be something like 'translation IS' => null.

I know how to do basic queries and a little more, but that’s not the problem.
The current TranslateBehavior system returns all translations that exist like:
$category = $this->Categories->get('1', ['finder' => 'translations']);

This code returns all the translations that are saved in the database like: 'de', 'fr', 'es', 'it', 'pt'

That’s fine, but what I’m looking for is that if for example I want to display some languages like: 'de', 'fr', 'es' and that the language fr is not registered and not existst in the database.
using this code:
$category = $this->Categories->get('1', ['finder' => 'translations', 'locales' => ['de', 'fr', 'es']]);

The result returned will be for languages 'de' and 'es' which are normal, but how to include 'fr' in the result with a NULL/EMPTY value?

That’s what I’m looking for. I hope my problem is clearer now.
Thanks for your help