#5714: "Undefined index: database" in datasource.php
---------------------------+------------------------------------------------
Reporter: dho | Type: Bug
Status: new | Priority: Medium
Milestone: 1.2.x.x | Component: General
Version: RC3 | Severity: Normal
Keywords: | Php_version: n/a
Cake_version: 1.2.0.7831 |
---------------------------+------------------------------------------------
I'm trying to write a custom data source and with the skeleton of a data
source I get the following notice:
{{{
Undefined index: database
[CORE/cake/libs/model/datasources/datasource.php, line 199]
}}}
Here my data source (I just copied the methods labeled "To-Be-Overriden in
subclasses" from datasource.php):
{{{
class ExampleSource extends DataSource {
public function create(&$model, $fields = null, $values = null) {
return false;
}
public function read(&$model, $queryData = array()) {
return false;
}
public function update(&$model, $fields = null, $values = null) {
return false;
}
public function delete(&$model, $id = null) {
if ($id == null) {
$id = $model->id;
}
}
public function resolveKey($model, $key) {
return $model->alias . $key;
}
}
}}}
In my database.php I have specified the data source in the following way:
{{{
public $test = array('datasource' => 'example');
}}}
And in the model I have
{{{
public $useDbConfig = 'test';
}}}
If I call the empty index action of my controller I get the aforementioned
notice.
--
Ticket URL: <https://trac.cakephp.org/ticket/5714>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC.
Our primary goal is to provide a structured framework that enables PHP users at
all levels to rapidly develop robust web applications, without any loss to
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"tickets cakephp" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---