Vorch
(Vorch@n1975)
1
i get
Call to a member function getDbCriteria() on a non-object
i’ve got write permission and the object is not empty, whats wrong ???
code:
$model = new Project(); //name of my model Project refers to Mysql innoDB table tblproject.
$daten=$model::model()->with('projectdetails')->findAll();
$dataProvider = new CActiveDataProvider($daten);
$this->render('index',array(
'dataProvider'=>$dataProvider,
));
zaccaria
(Matteo Falsitta)
2
Check in your view, maybe you have a typo and you are not giving the correct dataprovider to the zii widget.
Vorch
(Vorch@n1975)
3
i don’t know what a “typo” is ?
zaccaria
(Matteo Falsitta)
4
Is a typing error. Is very probably that you simply wrote incorrectly somewhere a variable name, so you pass a null instead of the dataprovider.
Vorch
(Vorch@n1975)
5
first i thank for the quick answer
but im sure that i pass the correct variable name - u can see the code above
Vorch
(Vorch@n1975)
6
made a little progress, but didn’t got far:
original my class is: myclass extends Controller;
guide says i’ve got to extend CActiveDataProvider.
And i can’t find class Controller in the library.
zaccaria
(Matteo Falsitta)
7
No, the class you are writing is a controller, so you have to extends CController.
The auto-generated code that you are using extends Controller, wich is a file in /protected/components wich extends CController.
The code you shared is correct, the point is if in the view index you are correctly passing the variable to the widget.
Vorch
(Vorch@n1975)
8
ok i obviously have to use the model (extends CActiveRecord) and pass it to the controller
So i created a method ( public function ) in the Model.
but now it says:
Fatal error: Call to a member function getDbCriteria() on a non-object in C:\xampp\yii\framework\web\CActiveDataProvider.php on line 114
it happens somewhere in the view, zaccaria was right with that,
but i don’t
have any clue
what and where
in the view
Vorch
(Vorch@n1975)
9
@zaccaria
posted my last reply before i saw yours. im trying now to find the error in the view