1
0
mirror of https://github.com/monstra-cms/monstra.git synced 2025-08-02 19:27:52 +02:00

XMLDB: new method existsField() added.

This commit is contained in:
Awilum
2012-11-17 17:48:49 +02:00
parent 8ef6d82c8b
commit 4df027d1c1

View File

@@ -493,6 +493,34 @@
}
/**
* Check if field exist
*
* <code>
* if ($users->existsField('field_name')) {
* // do something...
* }
* </code>
*
* @param string $name Name of field to check.
* @return boolean
*/
public function existsField($name) {
// Redefine vars
$name = (string) $name;
// Get table
$table = $this->table;
// Select field
$field = Table::_selectOne($this->table, "fields/{$name}");
// Return true or false
return ($field == null) ? false : true;
}
/**
* Add new record
*