1
0
mirror of synced 2025-01-19 15:01:40 +03:00
doctrine2/classes/IndexGenerator.php
doctrine cb79b1d995
2006-04-16 20:38:17 +00:00

27 lines
602 B
PHP

<?php
class Doctrine_IndexGenerator {
/**
* @var string $name
*/
private $name;
/**
* @param string $name
*/
public function __construct($name) {
$this->name = $name;
}
/**
* @param Doctrine_Record $record
* @return mixed
*/
public function getIndex(Doctrine_Record $record) {
$value = $record->get($this->name);
if($value === null)
throw new Doctrine_Exception("Couldn't create collection index. Record field '".$this->name."' was null.");
return $value;
}
}
?>