1
0
mirror of synced 2025-01-30 03:51:43 +03:00

Added better support for attributes generation in doctrine records

This commit is contained in:
Jonathan.Wage 2007-10-25 21:01:29 +00:00
parent 872c81cb5a
commit 2ff1dcadc5

View File

@ -455,18 +455,24 @@ END;
{ {
$build = "\n"; $build = "\n";
foreach ($attributes as $key => $value) { foreach ($attributes as $key => $value) {
if ( ! is_array($value)) {
$value = array($value); if (is_bool($value))
} {
$values = $value ? 'true':'false';
} else {
if ( ! is_array($value)) {
$value = array($value);
}
$values = ''; $values = '';
foreach ($value as $attr) { foreach ($value as $attr) {
$values .= "Doctrine::" . strtoupper($key) . "_" . strtoupper($attr) . ' ^ '; $values .= "Doctrine::" . strtoupper($key) . "_" . strtoupper($attr) . ' ^ ';
}
// Trim last ^
$values = substr($values, 0, strlen($values) - 3);
} }
// Trim last ^
$values = substr($values, 0, strlen($values) - 3);
$build .= "\t\t\$this->setAttribute(Doctrine::ATTR_" . strtoupper($key) . ", " . $values . ");\n"; $build .= "\t\t\$this->setAttribute(Doctrine::ATTR_" . strtoupper($key) . ", " . $values . ");\n";
} }