I am wondering how I can use the data from model B while I check model A, here, to check if the entered Banknumber is correct:
My users determine their bank account during registration. For example. "banknumber". I check this in the usual way in my user.php model
var $validate = array( 'banknumber' => array( 'minLength' => array( 'rule' => array('minLength', 8), 'message' => '...', 'required' => true, ),
Now I want to know if the entered Banknumber is real, so I got the βBanksβ table in my database with all the real Banknumbers, and I use some of the own verification functions that I specify in app_model.php.
function checkBankExists($data) { if (!$this->Bank->findByBanknumber($data)) { return false; } else { return true; } }
But this never works, because while I test the User-Model, I can only use this one in the app_model function, accessing it with the name this this this this this> the this this the this this this this this this this this the this this the this this this the the this this the the this this the IMPOSSIBLE i get:
Undefined property: User :: $ Bank [APP \ app_model.php
Call member function findByBanknumber () for a non-object
Is there any way to import / access other models in a function in app_model.php?
Thanks!
Bob
source share