Returning default column type for models with no schema defined

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6482 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2008-02-28 01:53:54 +00:00
parent 3a11fe2340
commit 97dded350f
2 changed files with 2 additions and 8 deletions

View file

@ -886,13 +886,10 @@ class Model extends Overloadable {
*/
function getColumnType($column) {
$cols = $this->schema();
if (empty($cols)) {
trigger_error(__('(Model::getColumnType) Unable to locate model field data. If you are using a model without a database table, try implementing schema()', true), E_USER_WARNING);
}
if (isset($cols[$column]['type'])) {
if (isset($cols[$column]) && isset($cols[$column]['type'])) {
return $cols[$column]['type'];
}
return null;
return 'string';
}
/**
* Returns true if this Model has given field in its database table.

View file

@ -119,9 +119,6 @@ class FormHelper extends AppHelper {
if (isset($object)) {
$fields = $object->schema();
if (empty($fields)) {
trigger_error(__('(FormHelper::create) Unable to use model field data. If you are using a model without a database table, try implementing schema()', true), E_USER_WARNING);
}
if (!empty($object->hasAndBelongsToMany)) {
foreach ($object->hasAndBelongsToMany as $alias => $assocData) {
$fields[$alias] = array('type' => 'multiple');