I want to create a some kind of data duplication check before insertion into the database.
//@param string $table
//@param Array $columnArray
//ie.Array(firstColumnName=>$firstData, secondColumnName=>$seconddata )
//@return
function isRecordExist($table, $columnArray)
{
return true; // if record exist in mentioned columns
}
Its just dummy implementation. I am looking some generic implementation which I can place as global function and which can be accessible in all modules of the zend project.
As a expert, Could any of you guide me what is the best way to create this function and where so that it would be accessible everywhere.
I have read about Zend_Validate_Db_NoRecordExists, which can be used in elements of form decorator. but in above scenario how we can create class so we can validate the data (in multiple columns) before insertion.
I have create this class in php and used many years. Now when I am working in zend so I am looking for best solutions so that i can create these components to use in my projects.
Thanks for your help.
I did something like this using doctrine.
and then access it using
I am sure there must be better way to integrate this in zend. but Don’t know that could be…