#166 Allow the definition of persistent classes having no table defined, and added a sample code for a null password authentication scheme

SVN:trunk[627]
This commit is contained in:
Romain Quetiez
2010-07-26 08:32:37 +00:00
parent 437066516d
commit b3594f5899
5 changed files with 86 additions and 6 deletions

View File

@@ -761,6 +761,10 @@ abstract class DBObject
private function DBInsertSingleTable($sTableClass)
{
$sTable = MetaModel::DBGetTable($sTableClass);
// Abstract classes or classes having no specific attribute do not have an associated table
if ($sTable == '') return;
$sClass = get_class($this);
// fields in first array, values in the second
@@ -788,7 +792,6 @@ abstract class DBObject
if (count($aValuesToWrite) == 0) return false;
$sTable = MetaModel::DBGetTable($sTableClass);
$sInsertSQL = "INSERT INTO `$sTable` (".join(",", $aFieldsToWrite).") VALUES (".join(", ", $aValuesToWrite).")";
$iNewKey = CMDBSource::InsertInto($sInsertSQL);
@@ -850,7 +853,6 @@ abstract class DBObject
foreach(MetaModel::EnumParentClasses($sClass) as $sParentClass)
{
if ($sParentClass == $sRootClass) continue;
if (MetaModel::DBGetTable($sParentClass) == "") continue;
$this->DBInsertSingleTable($sParentClass);
}