本文整理汇总了PHP中Doctrine_Table::getClassnameToReturn方法的典型用法代码示例。如果您正苦于以下问题:PHP Doctrine_Table::getClassnameToReturn方法的具体用法?PHP Doctrine_Table::getClassnameToReturn怎么用?PHP Doctrine_Table::getClassnameToReturn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine_Table
的用法示例。
在下文中一共展示了Doctrine_Table::getClassnameToReturn方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: obtainCollectionName
/**
* Collections tag name
*
* @return string
*/
public static function obtainCollectionName(Doctrine_Table $table)
{
return self::getBaseClassName($table->getClassnameToReturn());
}
示例2: do_validate
/**
* Helper function to run doctrine level validation on data. Returns an
* array('colname' => 'error message'). Only 1 validation error message
* will be returned per column.
*
* @param Doctrine_Table $table
* @param array $data
* @return array
*/
protected function do_validate($table, $data)
{
$errs = array();
if ($data) {
// check for static "remote_validate" function on table
$cls = $table->getClassnameToReturn();
if (method_exists($cls, self::$VALIDATE_METHOD_NAME)) {
$myerrs = call_user_func(array($cls, self::$VALIDATE_METHOD_NAME), $data);
if (count($myerrs)) {
return $myerrs;
// return early
}
}
// normal doctrine validation
foreach ($data as $column => $value) {
if (!$table->hasColumn($column)) {
$errs[$column] = 'Unknown column';
} else {
$col_err = false;
$stack = $table->validateField($column, $value);
// get the first problem (if any)
if (isset($stack[$column]) && count($stack[$column])) {
$col_err = $stack[$column][0];
}
$stack->clear();
// check extra unique columns, which aren't unique in the
// models, but should be validated as such
if (!$col_err && in_array($column, $this->enforce_uniques)) {
$found = $table->findOneBy($column, $value);
if ($found) {
$col_err = 'unique';
}
}
// set error for this column
if ($col_err) {
$errs[$column] = $col_err;
}
}
}
}
return $errs;
}