Executing in method checkUnique the line $res=$select->fetchArray(); in the following class I get an error which I cannot solve.
I think it is due to the naming conventions zend autoloader
class Twit_Model_Owners extends Twit_Model_BaseOwners {
function checkUnique($username) {
$con = Doctrine_Manager::getInstance()->connection();
$select = $con->createQuery();
$select->from($this->getTable()->getTableName(), array('loginName'))
->where('loginName=?', $username);
$res=$select->fetchArray();
if (empty($res)) {
return true;
}
return false;
}
}
The exception:
Application error
Exception information:
Message: Couldn't find class Owners
Stack trace:
#0 /usr/share/php/Doctrine/lib/Doctrine/Table.php(256): Doctrine_Table->initDefinition()
#1 /usr/share/php/Doctrine/lib/Doctrine/Connection.php(1126): Doctrine_Table->__construct('Owners', Object(Doctrine_Connection_Mysql), true)
#2 /usr/share/php/Doctrine/lib/Doctrine/Query.php(1942): Doctrine_Connection->getTable('Owners')
#3 /usr/share/php/Doctrine/lib/Doctrine/Query.php(1740): Doctrine_Query->loadRoot('Owners', 'Owners')
#4 /usr/share/php/Doctrine/lib/Doctrine/Query/From.php(88): Doctrine_Query->load('Owners')
#5 /usr/share/php/Doctrine/lib/Doctrine/Query/Abstract.php(2077): Doctrine_Query_From->parse('Owners')
#6 /usr/share/php/Doctrine/lib/Doctrine/Query.php(1167): Doctrine_Query_Abstract->_processDqlQueryPart('from', Array)
#7 /usr/share/php/Doctrine/lib/Doctrine/Query.php(1133): Doctrine_Query->buildSqlQuery(true)
#8 /usr/share/php/Doctrine/lib/Doctrine/Query/Abstract.php(958): Doctrine_Query->getSqlQuery(Array)
#9 /usr/share/php/Doctrine/lib/Doctrine/Query/Abstract.php(1026): Doctrine_Query_Abstract->_execute(Array)
#10 /usr/share/php/Doctrine/lib/Doctrine/Query.php(267): Doctrine_Query_Abstract->execute(Array, 3)
#11 /var/www/twit/application/models/Owners.php(20): Doctrine_Query->fetchArray()
#12 /var/www/twit/application/controllers/AuthController.php(62): Twit_Model_Owners->checkUnique('a')
#13 /usr/share/php/libzend-framework-php/Zend/Controller/Action.php(516): AuthController->signupAction()
#14 /usr/share/php/libzend-framework-php/Zend/Controller/Dispatcher/Standard.php(295): Zend_Controller_Action->dispatch('signupAction')
#15 /usr/share/php/libzend-framework-php/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#16 /usr/share/php/libzend-framework-php/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()
#17 /usr/share/php/libzend-framework-php/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#18 /var/www/twit/public/index.php(30): Zend_Application->run()
#19 {main}
Request Parameters:
array (
'module' => 'default',
'controller' => 'auth',
'action' => 'signup',
'username' => 'a',
'password' => 'x',
'confirmPassword' => 'x',
'captcha' =>
array (
'id' => 'ae5e3ce58bcf69e25ccdbba601029325',
'input' => 'hen753',
),
'register' => 'Sign up',
)
I can instantiate models without problem. This is the code i use to generate models:
Doctrine::generateModelsFromDb('/var/www/twit/application/models', array('zenddb'), array(
'baseClassesDirectory' => '',
'classPrefix' => 'Twit_Model_',
'classPrefixFiles' => false
));
Furthermore, if you want, you can visit the sample page here and get the error by yourself here.
http://94.94.19.135/twit/public/index.php/signup
It seems that Doctrine does not want the name of the table, as returned by $this->getTable()->getTableName()
but the name of the object (in my case Twit_Model_Owners)
personally I cannot understand such choice (to abstract is ok but at least the name of the tables in the query builder should be mantained), but I complain.
Related
I am using Humhub framework (based on Yii 2 framework). I've setup the queue jobs, and run the command queue/listen. I created a new job in protected\modules\wiki\jobs\AddCoOwnerJob.php like this:
namespace humhub\modules\wiki\jobs;
use humhub\modules\queue\ActiveJob;
class AddCoOwnerJob extends ActiveJob { ... }
But the system logs the following error:
yii\base\InvalidArgumentException: Job 578423 must be a JobInterface instance instead of __PHP_Incomplete_Class
How can I fix this? I've only seen this job getting errors, no problem with other default jobs.
This is the config for queue:
'queue' => [
'class' => 'humhub\modules\queue\driver\Redis'
],
My stack:
PHP 7.2 (apcu disabled)
Yii 2 Queue class => humhub\modules\queue\driver\Redis
You can see the full log below:
yii\base\InvalidArgumentException: Job 578423 must be a JobInterface instance instead of __PHP_Incomplete_Class#1
(
[__PHP_Incomplete_Class_Name] => 'humhub\\modules\\wiki\\jobs\\AddCoOwnerJob'
[humhub\modules\wiki\jobs\AddCoOwnerJob:wikiPage] => humhub\modules\wiki\models\WikiPage#2
( ...contains data... )
[originatorId] => 48646
). in /var/www/localhost/htdocs/protected/vendor/yiisoft/yii2-queue/src/Queue.php:199
Stack trace:
#0 /var/www/localhost/htdocs/protected/vendor/yiisoft/yii2-queue/src/cli/Queue.php(162): yii\queue\Queue->handleMessage('578423', 'O:38:"humhub\\mo...', '300', '1')
#1 /var/www/localhost/htdocs/protected/vendor/yiisoft/yii2-queue/src/cli/Command.php(145): yii\queue\cli\Queue->execute('578423', 'O:38:"humhub\\mo...', '300', '1', '2821')
#2 [internal function]: yii\queue\cli\Command->actionExec('578423', '300', '1', '2821')
#3 /var/www/localhost/htdocs/protected/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#4 /var/www/localhost/htdocs/protected/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#5 /var/www/localhost/htdocs/protected/vendor/yiisoft/yii2/console/Controller.php(164): yii\base\Controller->runAction('exec', Array)
#6 /var/www/localhost/htdocs/protected/vendor/yiisoft/yii2/base/Module.php(528): yii\console\Controller->runAction('exec', Array)
#7 /var/www/localhost/htdocs/protected/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('queue/exec', Array)
#8 /var/www/localhost/htdocs/protected/vendor/yiisoft/yii2/console/Application.php(147): yii\console\Application->runAction('queue/exec', Array)
#9 /var/www/localhost/htdocs/protected/vendor/yiisoft/yii2/base/Application.php(386): yii\console\Application->handleRequest(Object(yii\console\Request))
#10 /var/www/localhost/htdocs/protected/yii(29): yii\base\Application->run()
#11 {main}
I have read Extending ZfcUser's UserController in custom module and and did everything as it was written but I still getting error:
/vagrant/app/vendor/zf-commons/zfc-user/src/ZfcUser/Controller/UserController.php:69
You must supply a callable redirectCallback
Stack trace:
#0 /vagrant/app/vendor/zendframework/zend-servicemanager/src/AbstractPluginManager.php(207): ZfcUser\Controller\UserController->__construct()
#1 /vagrant/app/vendor/zendframework/zend-servicemanager/src/ServiceManager.php(642): Zend\ServiceManager\AbstractPluginManager->createFromInvokable('zfcuser', 'zfcuser')
#2 /vagrant/app/vendor/zendframework/zend-servicemanager/src/ServiceManager.php(598): Zend\ServiceManager\ServiceManager->doCreate('zfcuser', 'zfcuser')
#3 /vagrant/app/vendor/zendframework/zend-servicemanager/src/ServiceManager.php(530): Zend\ServiceManager\ServiceManager->create(Array)
#4 /vagrant/app/vendor/zendframework/zend-servicemanager/src/AbstractPluginManager.php(116): Zend\ServiceManager\ServiceManager->get('zfcuser', false)
#5 /vagrant/app/vendor/zendframework/zend-mvc/src/Controller/ControllerManager.php(137): Zend\ServiceManager\AbstractPluginManager->get('zfcuser', Array, false)
#6 /vagrant/app/vendor/zendframework/zend-mvc/src/Controller/Plugin/Forward.php(121): Zend\Mvc\Controller\ControllerManager->get('zfcuser')
#7 /vagrant/app/vendor/socalnick/scn-social-auth/src/ScnSocialAuth/Controller/UserController.php(118): Zend\Mvc\Controller\Plugin\Forward->dispatch('zfcuser', Array)
#8 /vagrant/app/vendor/zendframework/zend-mvc/src/Controller/AbstractActionController.php(82): ScnSocialAuth\Controller\UserController->loginAction()
#9 [internal function]: Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
#10 /vagrant/app/vendor/zendframework/zend-eventmanager/src/EventManager.php(444): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#11 /vagrant/app/vendor/zendframework/zend-eventmanager/src/EventManager.php(205): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#12 /vagrant/app/vendor/zendframework/zend-mvc/src/Controller/AbstractController.php(118): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#13 /vagrant/app/vendor/zendframework/zend-mvc/src/DispatchListener.php(93): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request), Object(Zend\Http\PhpEnvironment\Response))
#14 [internal function]: Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#15 /vagrant/app/vendor/zendframework/zend-eventmanager/src/EventManager.php(444): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#16 /vagrant/app/vendor/zendframework/zend-eventmanager/src/EventManager.php(205): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#17 /vagrant/app/vendor/zendframework/zend-mvc/src/Application.php(314): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#18 /vagrant/app/public/index.php(21): Zend\Mvc\Application->run()
#19 {main}
In MyModule\Module.php I did like this:
public function getControllerConfig()
{
return array(
'factories' => array(
'User\Controller\User' => function($controllerManager) {
$serviceManager = $controllerManager->getServiceLocator();
$redirectCallback = $serviceManager->get('zfcuser_redirect_callback');
$controller = new \ZfcUser\Controller\UserController($redirectCallback);
return $controller;
},
),
);
}
My extended User Controller looks like:
class UserController extends \ZfcUser\Controller\UserController {
public function loginAction() {
// customs actions
}
I also included ScnSocialAuth module that have own UserController.
Why I want to do it that way? I'm writing SPA application (Backbone+Marionette) and I need modal authentication. Maybe I missed something, or something wrong call - please help fix. I tried different ways but this would be the most optimal. In addition, the answer will be useful to other users. Thanks.
Controllers have their own config:
public function getControllerConfig()
{
return [
'factories' => [
// snip
Your error message says createFromInvokable in the trace. Make sure you don't have an invokable with the same locator name.
Also, your factory is returning the ZfcUser controller, not your custom one.
In order to extend ZfcUser controller in Module.php must be:
public function getControllerConfig()
{
return array(
'factories' => array(
'User\Controller\User' => function($controllerManager) {
$serviceManager = $controllerManager->getServiceLocator();
$redirectCallback = $serviceManager->get('zfcuser_redirect_callback');
$controller = new \User\Controller\UserController($redirectCallback);
return $controller;
},
),
);
}
and need to call custom user class instead zfcuser. Also my mistake was that in my module.config.php was it:
'controllers' => array(
'invokables' => array(
'User\Controller\User' => 'User\Controller\UserController'
),
),
Because of this, my factory is not called.
I have to access firebird with php and zend framework 2 and I'm having the following error:
/var/www/html/cad/vendor/zendframework/zendframework/library/Zend/Db/Adapter/Driver /Pdo/Statement.php:187
Message:
SQLSTATE[HY000]: General error: -204 Dynamic SQL Error SQL error code = -204 Table unknown pessoa At line 1, column 19
Stack trace:
#0 /var/www/html/cad/vendor/zendframework/zendframework/library/Zend/Db/Adapter/Driver /Pdo/Statement.php(187): PDO->prepare('SELECT "pessoa"...')
#1 /var/www/html/cad/vendor/zendframework/zendframework/library/Zend/Db/Adapter/Driver/Pdo/Statement.php(213): Zend\Db\Adapter\Driver\Pdo\Statement->prepare()
#2 /var/www/html/cad/vendor/zendframework/zendframework/library/Zend/Db/TableGateway/AbstractTableGateway.php(233): Zend\Db\Adapter\Driver\Pdo\Statement->execute()
#3 /var/www/html/cad/vendor/zendframework/zendframework/library/Zend/Db/TableGateway/AbstractTableGateway.php(208): Zend\Db\TableGateway\AbstractTableGateway->executeSelect(Object(Zend\Db\Sql\Select))
#4 /var/www/html/cad/vendor/zendframework/zendframework/library/Zend/Db/TableGateway/AbstractTableGateway.php(195): Zend\Db\TableGateway\AbstractTableGateway->selectWith(Object(Zend\Db\Sql\Select))
#5 /var/www/html/cad/module/Pessoa/src/Pessoa/Model/PessoaTable.php(18): Zend\Db\TableGateway\AbstractTableGateway->select()
#6 /var/www/html/cad/module/Pessoa/src/Pessoa/Controller/PessoaController.php(26): Pessoa\Model\PessoaTable->fetchAll()
#7 /var/www/html/cad/vendor/zendframework/zendframework/library/Zend/Mvc/Controller/AbstractActionController.php(83): Pessoa\Controller\PessoaController->indexAction()
#8 [internal function]: Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
#9 /var/www/html/cad/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(468): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#10 /var/www/html/cad/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(207): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#11 /var/www/html/cad/vendor/zendframework/zendframework/library/Zend/Mvc/Controller/AbstractController.php(117): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#12 /var/www/html/cad/vendor/zendframework/zendframework/library/Zend/Mvc/DispatchListener.php(114): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request), Object(Zend\Http\PhpEnvironment\Response))
#13 [internal function]: Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#14 /var/www/html/cad/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(468): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#15 /var/www/html/cad/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(207): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#16 /var/www/html/cad/vendor/zendframework/zendframework/library/Zend/Mvc/Application.php(313): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#17 /var/www/html/cad/public/index.php(17): Zend\Mvc\Application->run()
#18 {main}
Global.php
return array(
'db' => array(
'driver' => 'Pdo',
'dsn' => 'firebird:dbname=/opt/bancos/teste.fdb', //array(PDO::ATTR_PERSISTENT => true),
/*'driver_options' => array(
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\''
),*/
),
'service_manager' => array(
'factories' => array(
'Zend\Db\Adapter\Adapter'
=> 'Zend\Db\Adapter\AdapterServiceFactory',
),
),
);
?>
local.php
<?php
return array(
'db' => array(
'username' => 'sysdba',
'password' => 'masterkey',
),
);
?>
PessoaController.php
public function indexAction()
{
return new ViewModel(array(
'pessoas' => $this->getPessoaTable()->fetchAll(),
));
}
PessoaTable.php
public function fetchAll()
{
try{
$resultSet = $this->tableGateway->select();
} catch(Exception $e){
$e->getMessage();
}
return $resultSet;
}
and here is the method getPessoaTable()
public function getPessoaTable()
{
if (!$this->pessoaTable) {
$sm = $this->getServiceLocator();
$this->pessoaTable = $sm->get('Pessoa\Model\PessoaTable');
}
return $this->pessoaTable;
}
I have configured pdo_firebird.so in php. And it shows up on phpinfo()
The important part of the error is: "Table unknown pessoa". You are selecting from a table pessoa, no such table exists according to Firebird. The fact that pessoa is lower case in the error message shows you are using quoted identifiers. Quoted identifiers are case sensitive in Firebird. Unquoted identifiers are upper cased to make them case insensitive.
So this error either means the table really doesn't exist, or - as you use quoted identifiers - the table name is actually PESSOA. The rules Firebird uses for quoted/unquoted identifiers will make SELECT ... FROM pessoa work, but SELECT ... FROM "pessoa" fail.
I don't know PDO, so I can't give a PDO specific help, but I hope this narrows it down for you.
I am trying to install and use this robregonm / yii2-auth module in my newly installed yii2 advance app.
I used composer to install it.
using this command
php composer.phar require robregonm/yii2-auth "dev-master"
I have configured my web and console files accordingly.
now I am trying to run migration as mentioned using
./yii migrate/up --migrationPath=#auth/migrations
And I am getting following error.
Exception 'yii\base\UnknownPropertyException' with message 'Setting unknown property: yii\db\Connection::user'
in /var/www/mycoolapp/vendor/yiisoft/yii2/base/Component.php:196
Stack trace:
#0 /var/www/mycoolapp/vendor/yiisoft/yii2/BaseYii.php(515): yii\base\Component->__set('user', Array)
#1 /var/www/mycoolapp/vendor/yiisoft/yii2/base/Object.php(104): yii\BaseYii::configure(Object(yii\db\Connection), Array)
#2 [internal function]: yii\base\Object->__construct(Array)
#3 /var/www/mycoolapp/vendor/yiisoft/yii2/di/Container.php(365): ReflectionClass->newInstanceArgs(Array)
#4 /var/www/mycoolapp/vendor/yiisoft/yii2/di/Container.php(147): yii\di\Container->build('yii\db\Connecti...', Array, Array)
#5 /var/www/mycoolapp/vendor/yiisoft/yii2/BaseYii.php(341): yii\di\Container->get('yii\db\Connecti...', Array, Array)
#6 /var/www/mycoolapp/vendor/yiisoft/yii2/di/ServiceLocator.php(132): yii\BaseYii::createObject(Array)
#7 /var/www/mycoolapp/vendor/yiisoft/yii2/console/controllers/MigrateController.php(124): yii\di\ServiceLocator->get('db')
#8 /var/www/mycoolapp/vendor/yiisoft/yii2/base/Controller.php(144): yii\console\controllers\MigrateController->beforeAction(Object(yii\base\InlineAction))
#9 /var/www/mycoolapp/vendor/yiisoft/yii2/console/Controller.php(83): yii\base\Controller->runAction('up', Array)
#10 /var/www/mycoolapp/vendor/yiisoft/yii2/base/Module.php(444): yii\console\Controller->runAction('up', Array)
#11 /var/www/mycoolapp/vendor/yiisoft/yii2/console/Application.php(164): yii\base\Module->runAction('migrate/up', Array)
#12 /var/www/mycoolapp/vendor/yiisoft/yii2/console/Application.php(140): yii\console\Application->runAction('migrate/up', Array)
#13 /var/www/mycoolapp/vendor/yiisoft/yii2/base/Application.php(329): yii\console\Application->handleRequest(Object(yii\console\Request))
#14 /var/www/mycoolapp/yii(30): yii\base\Application->run()
#15 {main}
PHP Fatal error: Uncaught exception 'yii\base\InvalidConfigException' with message 'Unable to append to log file: /var/www/mycoolapp/console/runtime/logs/app.log' in /var/www/mycoolapp/vendor/yiisoft/yii2/log/FileTarget.php:87
Stack trace:
#0 /var/www/mycoolapp/vendor/yiisoft/yii2/log/Target.php(103): yii\log\FileTarget->export()
#1 /var/www/mycoolapp/vendor/yiisoft/yii2/log/Dispatcher.php(179): yii\log\Target->collect(Array, true)
#2 /var/www/mycoolapp/vendor/yiisoft/yii2/log/Logger.php(162): yii\log\Dispatcher->dispatch(Array, true)
#3 [internal function]: yii\log\Logger->flush(true)
#4 {main}
thrown in /var/www/mycoolapp/vendor/yiisoft/yii2/log/FileTarget.php on line 87
I am confused about whats missing here?
I can not find auth module anywhere in app.
My question is where should I clone yii2-auth in app?
It seems that you misconfigured the db component in your config file, because, the user param does not exist, maybe you meant username. So the problem is not the extension itself but your local configuration setup.
Your db component should look like this:
'db' => [
'class' => 'yii\db\Connection',
'dsn' => 'pgsql:dbname=YourDbName...', // replace pgsql with your db driver
'username' => 'YourUsername',
'password' => 'YourPwd',
'enableSchemaCache' => false,
'charset' => 'utf8',
],
Hope this helps.
Change you console/config/main-local.php, replace the key preload with bootstrap.
return [
'preload' => [
//'debug',
],
'modules' => [
//'debug' => 'yii\debug\Module',
//'gii' => 'yii\gii\Module',
],
];
TO
return [
'bootstrap' => [
//'debug',
],
'modules' => [
//'debug' => 'yii\debug\Module',
//'gii' => 'yii\gii\Module',
],
];
i'm facing a problem passing the correct value to the grid widget in the view. The data is being passed from jquery using ajax.
Here is the code::
$('#find-product').click(function(e) {
e.preventDefault();
alert($('#find-product').data("url"));
/*
* Make the ajax call to send the selected option to the controller for processing
* URL : $('#find-product').data("url") , the path of the controller's action
* Dropdown : the obejct that is passed to the controller
*
* Dropdown.category : the category selected
* Dropdown.price : the price range selected
*
*
*/
$.ajax({
url: $('#find-product').data("url"),
data: {
Dropdown: {
category: $('#supp-category').find(":selected").text(),
price: $('#supp-price').find(":selected").text()
}
},
type: "POST",
error: function(xhr, tStatus, e) {
if (!xhr) {
alert(" We have an error ");
alert(tStatus + " " + e.message);
} else {
alert("else: " + e.message); // the great unknown
}
},
success: function(resp) {
document.location.href = $('#find-product').data("url");
}
})
});
So i want to send the object named Dropdown to the controller action. In this case its /products/dropdown.
In the actionDropdown() i'm trying to form a CDbCriteria and passing it to CActiveDataProvider so that i may use it to render the grid.
Here is the code for the actionDropdown in the ProductsController ::
public function actionDropdown() {
$criteria = new CDbCriteria;
$criteria->compare('category', $_POST['Dropdown']['category'], true);
$dataProvider = new CActiveDataProvider('Products', array(
'criteria' => $criteria,
));
$this->render('selectproducts', array(
'dataProvider' => $dataProvider,
));
}
And here is the view, called selectproducts.
<div class="row">
<?php
$this->widget('bootstrap.widgets.TbGridView', array(
'id' => 'products-grid',
'dataProvider' => $dataProvider,
'filter' => $dataProvider,
'columns' => array(
'id',
'name',
'category',
'brand',
'weight_unit',
'price_unit',
'flavors',
'providers',
),
));
?>
</div>
Now this is giving me an CException error. Here is the error stack trace::
CException
CActiveDataProvider and its behaviors do not have a method or closure named "getValidators". (/var/www/html/yii/framework/base/CComponent.php:266)
#0 /var/www/html/yii/framework/web/helpers/CHtml.php(2236): CComponent->__call('getValidators', Array)
#1 /var/www/html/yii/framework/web/helpers/CHtml.php(2236): CActiveDataProvider->getValidators('id')
#2 /var/www/html/yii/framework/web/helpers/CHtml.php(1434): CHtml::activeInputField('text', Object(CActiveDataProvider), 'id', Array)
#3 /var/www/html/EasyAesthetics/protected/extensions/yiibooster/widgets/TbDataColumn.php(109): CHtml::activeTextField(Object(CActiveDataProvider), 'id', Array)
#4 /var/www/html/EasyAesthetics/protected/extensions/yiibooster/widgets/TbDataColumn.php(74): TbDataColumn->renderFilterCellContent()
#5 /var/www/html/yii/framework/zii/widgets/grid/CGridView.php(532): TbDataColumn->renderFilterCell()
#6 /var/www/html/yii/framework/zii/widgets/grid/CGridView.php(510): CGridView->renderFilter()
#7 /var/www/html/yii/framework/zii/widgets/grid/CGridView.php(480): CGridView->renderTableHeader()
#8 /var/www/html/yii/framework/zii/widgets/CBaseListView.php(167): CGridView->renderItems()
#9 [internal function]: CBaseListView->renderSection(Array)
#10 /var/www/html/yii/framework/zii/widgets/CBaseListView.php(150): preg_replace_callback('/{(\w+)}/', Array, '{summary}?{item...')
#11 /var/www/html/yii/framework/zii/widgets/CBaseListView.php(135): CBaseListView->renderContent()
#12 /var/www/html/yii/framework/web/CBaseController.php(173): CBaseListView->run()
#13 /var/www/html/EasyAesthetics/protected/views/products/selectproducts.php(37): CBaseController->widget('bootstrap.widge...', Array)
#14 /var/www/html/yii/framework/web/CBaseController.php(126): require('/var/www/html/E...')
#15 /var/www/html/yii/framework/web/CBaseController.php(95): CBaseController->renderInternal('/var/www/html/E...', Array, true)
#16 /var/www/html/yii/framework/web/CController.php(869): CBaseController->renderFile('/var/www/html/E...', Array, true)
#17 /var/www/html/yii/framework/web/CController.php(782): CController->renderPartial('selectproducts', Array, true)
#18 /var/www/html/EasyAesthetics/protected/controllers/ProductsController.php(248): CController->render('selectproducts', Array)
#19 /var/www/html/yii/framework/web/actions/CInlineAction.php(49): ProductsController->actionDropdown()
#20 /var/www/html/yii/framework/web/CController.php(308): CInlineAction->runWithParams(Array)
#21 /var/www/html/yii/framework/web/filters/CFilterChain.php(133): CController->runAction(Object(CInlineAction))
#22 /var/www/html/yii/framework/web/filters/CFilter.php(40): CFilterChain->run()
#23 /var/www/html/yii/framework/web/CController.php(1145): CFilter->filter(Object(CFilterChain))
#24 /var/www/html/yii/framework/web/filters/CInlineFilter.php(58): CController->filterAccessControl(Object(CFilterChain))
#25 /var/www/html/yii/framework/web/filters/CFilterChain.php(130): CInlineFilter->filter(Object(CFilterChain))
#26 /var/www/html/yii/framework/web/CController.php(291): CFilterChain->run()
#27 /var/www/html/yii/framework/web/CController.php(265): CController->runActionWithFilters(Object(CInlineAction), Array)
#28 /var/www/html/yii/framework/web/CWebApplication.php(282): CController->run('dropdown')
#29 /var/www/html/yii/framework/web/CWebApplication.php(141): CWebApplication->runController('products/dropdo...')
#30 /var/www/html/yii/framework/base/CApplication.php(180): CWebApplication->processRequest()
#31 /var/www/html/EasyAesthetics/index.php(13): CApplication->run()
#32 {main}
I cannot for the life of me figure out what is causing this error. Please provide any sort of help, any tip that will head me in the right direction.
Thanks, in advance.
Maxx
The problem is with filter param in TbGridView. Filter must be instance of your model, not dataprovider.
$this->widget('bootstrap.widgets.TbGridView', array(
'id' => 'products-grid',
'dataProvider' => $dataProvider,
'filter' => $dataProvider->model, // Simplest way
'columns' => array(
'id',
'name',
'category',
'brand',
'weight_unit',
'price_unit',
'flavors',
'providers',
),
));
Or just assign YourModel::model() as your filter param.