function getUniqueFrontendNam frontend this- find list array condition

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
function getUniqueFrontendName( $frontend ) {
$f = $this->find('list', array(
'conditions'=>array( 'frontend LIKE'=>"$frontend%" ),
'fields'=>array( 'frontend' )
));
if ($f) {
$lastNum = 0;
$frontend = $frontend.$lastNum;
while ( in_array($frontend, $f) ){
$lastNum++;
$frontend = substr($frontend, 0, - strlen($lastNum) ).$lastNum;
}
}
return $frontend;
}