Check if record exists in database using BuildRules (CakePHP 3)


I want to check if the ID passed by the user using a HTTP request exists in another table in cakephp. Right now, I tried using :
public function buildRules(RulesChecker $rules) { $rules->add($rules->existsIn('id_venue', 'venues')); return $rules; }
But It doesn’t seems to work. This rule is in a reservation table, in this table I have a column called id_venue, I have another table called Venues which has a primary key called id_venue too.
public function initialize(array $config) { parent::initialize($config); $this->table('reservations'); $this->primaryKey('id_reservation'); $this->hasOne('Venues'); }
I’ve associated my Reservations table with my Venues table

Thanks for helping.