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.
Related
I have a project that's setup with Laravel and Redis Queues. The application is configured to send push notifications when it receives a message. As soon as message is received, it's stored in the DB and a push is generated:
dispatch(new CreateMessageNotification($message));
Project is using Redis queue and Service Provider. The problem is that queue dispatch doesn't work if we don't execute the following command:
php artisan queue:work redis --daemon
However, when we do run this command, the application start to generate error logs below. It appears that some routine is stuck somewhere, and we're unable to figure out where, why and how? If we don't run this script, push notifications don't work. If we do run this script, push notifications work with delay, and ERROR logs are produced AND the size of log reaches to GB in a matter of an hour. What are we doing wrong here?
We're using Redis/Predis:
'redis' => [
'client' => 'predis',
'cluster' => env('REDIS_CLUSTER', false),
'default' => [
'host' => env('REDIS_HOST', 'localhost'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => env('REDIS_DB', 0),
'timeout' => 15.0,
],
],
For broadcasting, we're using Pusher:
'default' => env('BROADCAST_DRIVER', 'pusher'),
For queue, we're using Redis:
'default' => env('QUEUE_DRIVER', 'sync'),
QUEUE_DRIVER=redis
For cache, we're using Redis:
'default' => env('CACHE_DRIVER', 'file'),
CACHE_DRIVER=redis
CreateMessageNotification
<?php
namespace App\Jobs\EventHandlers;
use App\Events\Notifications\NewMessageCreatedEvent;
use App\Repositories\UserDevicesRepository;
use Event;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class CreateMessageNotification implements ShouldQueue
{
use InteractsWithQueue, Queueable, SerializesModels;
private $message;
public function __construct($message)
{
$this->message = $message;
}
public function handle()
{
Event::fire(new NewMessageCreatedEvent($this->message));
}
}
NewMessageCreatedEvent
<?php
namespace App\Events\Notifications;
use App\Models\Chat\Message;
use Event;
use Illuminate\Queue\SerializesModels;
class NewMessageCreatedEvent extends Event
{
use SerializesModels;
public function __construct(Message $message)
{
$message->load(['other', 'chat', 'chat.chatUsers']);
foreach ($message->chat->chatUsers as $chatUser) {
if ($chatUser->user_id !== $message->other->id) {
Event::fire(new NewMessageNotificationEvent($message, $chatUser->user_id));
}
}
}
}
ERROR LOG
[2018-09-06 06:28:55] local.ERROR: exception 'Illuminate\Broadcasting\BroadcastException' with message 'API call failed since (daily) message quota exceeded
' in /var/www/html/project/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php:106
Stack trace:
#0 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastEvent.php(49): Illuminate\Broadcasting\Broadcasters\PusherBroadcaster->broadcast(Array, 'new_$
#1 [internal function]: Illuminate\Broadcasting\BroadcastEvent->handle(Object(Illuminate\Broadcasting\Broadcasters\PusherBroadcaster))
#2 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(30): call_user_func_array(Array, Array)
#3 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#4 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Appli$
#5 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(539): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Arr$
#6 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(94): Illuminate\Container\Container->call(Array)
#7 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(114): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}(Object(Illuminate\Broadcasting\Broa$
#8 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Broadcast$
#9 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(98): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#10 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(43): Illuminate\Bus\Dispatcher->dispatchNow(Object(Illuminate\Broadcasting\BroadcastEv$
#11 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(69): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\RedisJob), Array)
#12 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(317): Illuminate\Queue\Jobs\Job->fire()
#13 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(267): Illuminate\Queue\Worker->process('redis', Object(Illuminate\Queue\Jobs\RedisJob), Object(Il$
#14 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(113): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\RedisJob), 'redis', Object(Ill$
#15 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(102): Illuminate\Queue\Worker->daemon('redis', 'default', Object(Illuminate\Queue\Wo$
#16 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(86): Illuminate\Queue\Console\WorkCommand->runWorker('redis', 'default')
#17 [internal function]: Illuminate\Queue\Console\WorkCommand->fire()
#18 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(30): call_user_func_array(Array, Array)
#19 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#20 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Appl$
#21 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(539): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Ar$
#22 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Console/Command.php(182): Illuminate\Container\Container->call(Array)
#23 /var/www/html/project/vendor/symfony/console/Command/Command.php(252): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\$
#24 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Console/Command.php(168): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\Ar$
#25 /var/www/html/project/vendor/symfony/console/Application.php(946): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\C$
#26 /var/www/html/project/vendor/symfony/console/Application.php(248): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symf$
#27 /var/www/html/project/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfon$
#28 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(122): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\In$
#29 /var/www/html/project/artisan(36): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\Conso$
#30 {main}
[2018-09-06 06:28:55] local.ERROR: exception 'ErrorException' with message 'Trying to get property of non-object' in /var/www/html/project/app/Events/Notifications/NewMessageCreate$
Stack trace:
#0 /var/www/html/project/app/Events/Notifications/NewMessageCreatedEvent.php(27): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Trying to get p...', '/var/www/h$
#1 /var/www/html/project/app/Jobs/EventHandlers/CreateMessageNotification.php(38): App\Events\Notifications\NewMessageCreatedEvent->__construct(Object(App\Models\Chat\Message))
#2 [internal function]: App\Jobs\EventHandlers\CreateMessageNotification->handle()
#3 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(30): call_user_func_array(Array, Array)
#4 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#5 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Appli$
#6 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(539): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Arr$
#7 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(94): Illuminate\Container\Container->call(Array)
#8 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(114): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}(Object(App\Jobs\EventHandlers\Creat$
#9 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(App\Jobs\EventHandle$
#10 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(98): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#11 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(43): Illuminate\Bus\Dispatcher->dispatchNow(Object(App\Jobs\EventHandlers\CreateMessag$
#12 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(69): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\RedisJob), Array)
#13 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(317): Illuminate\Queue\Jobs\Job->fire()
#14 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(267): Illuminate\Queue\Worker->process('redis', Object(Illuminate\Queue\Jobs\RedisJob), Object(Il$
#15 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(113): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\RedisJob), 'redis', Object(Ill$
#16 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(102): Illuminate\Queue\Worker->daemon('redis', 'default', Object(Illuminate\Queue\Wo$
#17 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(86): Illuminate\Queue\Console\WorkCommand->runWorker('redis', 'default')
#18 [internal function]: Illuminate\Queue\Console\WorkCommand->fire()
#19 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(30): call_user_func_array(Array, Array)
#20 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#21 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Appl$
#22 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(539): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Ar$
#23 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Console/Command.php(182): Illuminate\Container\Container->call(Array)
#24 /var/www/html/project/vendor/symfony/console/Command/Command.php(252): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\$
#25 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Console/Command.php(168): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\Ar$
#26 /var/www/html/project/vendor/symfony/console/Application.php(946): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\C$
#27 /var/www/html/project/vendor/symfony/console/Application.php(248): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symf$
#28 /var/www/html/project/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfon$
#29 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(122): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\In$
#30 /var/www/html/project/artisan(36): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\Conso$
What worked for me was to remove all failed jobs from the queue (after attempting to retry just one more time):
php artisan queue:restart
php artisan queue:work redis --daemon --tries=1
Re-run the queue:
php artisan queue:work redis --daemon
Also, I had to get rid to calls to Pusher which were failing to get this to work.
I am simply adding a paypal IPN (using the https://github.com/mike182uk/paypal-ipn-listener) to add credits to a users profile and add the order into the database. I actually had this working, but for some reason a day later, I noticed nothing being inserted into the DB and the users credits are not given. All I get in the laravel.log is this huge error log which seems to be all TokenMismatchException.
FYI: I am using the paypal sandbox to do this right now, so not sure if that matters or not, but it's quite slow in responding.
Full error log for that specific call:
[2015-01-12 00:21:15] production.ERROR: exception 'Illuminate\Session\TokenMismatchException' in /home/username/webapps/site_name/app/filters.php:88
Stack trace:
#0 [internal function]: {closure}(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#1 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(199): call_user_func_array(Object(Closure), Array)
#2 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(154): Illuminate\Events\Dispatcher->fire('router.filter: ...', Array, true)
#3 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1468): Illuminate\Events\Dispatcher->until('router.filter: ...', Array)
#4 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(240): Illuminate\Routing\Router->callRouteFilter('csrf', Array, Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#5 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(114): Illuminate\Routing\ControllerDispatcher->callFilter(Array, Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#6 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(55): Illuminate\Routing\ControllerDispatcher->before(Object(AuthController), Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'postLogin')
#7 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php(962): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'AuthController', 'postLogin')
#8 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}()
#9 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Route.php(109): call_user_func_array(Object(Closure), Array)
#10 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1028): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#11 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php(996): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#12 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(775): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#13 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(745): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request))
#14 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Session/Middleware.php(72): Illuminate\Foundation\Application->handle(Object(Illuminate\Http\Request), 1, true)
#15 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Cookie/Queue.php(47): Illuminate\Session\Middleware->handle(Object(Illuminate\Http\Request), 1, true)
#16 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Cookie/Guard.php(51): Illuminate\Cookie\Queue->handle(Object(Illuminate\Http\Request), 1, true)
#17 /home/username/webapps/site_name/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Illuminate\Cookie\Guard->handle(Object(Illuminate\Http\Request), 1, true)
#18 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(641): Stack\StackedHttpKernel->handle(Object(Illuminate\Http\Request))
#19 /home/username/webapps/site_name/public/index.php(49): Illuminate\Foundation\Application->run()
#20 {main} [] []
[2015-01-12 00:21:26] production.ERROR: exception 'Illuminate\Session\TokenMismatchException' in /home/username/webapps/site_name/app/filters.php:88
Stack trace:
#0 [internal function]: {closure}(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#1 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(199): call_user_func_array(Object(Closure), Array)
#2 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(154): Illuminate\Events\Dispatcher->fire('router.filter: ...', Array, true)
#3 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1468): Illuminate\Events\Dispatcher->until('router.filter: ...', Array)
#4 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(240): Illuminate\Routing\Router->callRouteFilter('csrf', Array, Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#5 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(114): Illuminate\Routing\ControllerDispatcher->callFilter(Array, Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#6 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(55): Illuminate\Routing\ControllerDispatcher->before(Object(AuthController), Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'postLogin')
#7 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php(962): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'AuthController', 'postLogin')
#8 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}()
#9 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Route.php(109): call_user_func_array(Object(Closure), Array)
#10 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1028): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#11 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php(996): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#12 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(775): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#13 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(745): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request))
#14 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Session/Middleware.php(72): Illuminate\Foundation\Application->handle(Object(Illuminate\Http\Request), 1, true)
#15 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Cookie/Queue.php(47): Illuminate\Session\Middleware->handle(Object(Illuminate\Http\Request), 1, true)
#16 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Cookie/Guard.php(51): Illuminate\Cookie\Queue->handle(Object(Illuminate\Http\Request), 1, true)
#17 /home/username/webapps/site_name/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Illuminate\Cookie\Guard->handle(Object(Illuminate\Http\Request), 1, true)
#18 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(641): Stack\StackedHttpKernel->handle(Object(Illuminate\Http\Request))
#19 /home/username/webapps/site_name/public/index.php(49): Illuminate\Foundation\Application->run()
#20 {main} [] []
[2015-01-12 00:21:46] production.ERROR: exception 'Illuminate\Session\TokenMismatchException' in /home/username/webapps/site_name/app/filters.php:88
Stack trace:
#0 [internal function]: {closure}(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#1 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(199): call_user_func_array(Object(Closure), Array)
#2 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(154): Illuminate\Events\Dispatcher->fire('router.filter: ...', Array, true)
#3 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1468): Illuminate\Events\Dispatcher->until('router.filter: ...', Array)
#4 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(240): Illuminate\Routing\Router->callRouteFilter('csrf', Array, Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#5 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(114): Illuminate\Routing\ControllerDispatcher->callFilter(Array, Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#6 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(55): Illuminate\Routing\ControllerDispatcher->before(Object(AuthController), Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'postLogin')
#7 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php(962): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'AuthController', 'postLogin')
#8 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}()
#9 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Route.php(109): call_user_func_array(Object(Closure), Array)
#10 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1028): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#11 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php(996): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#12 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(775): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#13 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(745): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request))
#14 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Session/Middleware.php(72): Illuminate\Foundation\Application->handle(Object(Illuminate\Http\Request), 1, true)
#15 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Cookie/Queue.php(47): Illuminate\Session\Middleware->handle(Object(Illuminate\Http\Request), 1, true)
#16 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Cookie/Guard.php(51): Illuminate\Cookie\Queue->handle(Object(Illuminate\Http\Request), 1, true)
#17 /home/username/webapps/site_name/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Illuminate\Cookie\Guard->handle(Object(Illuminate\Http\Request), 1, true)
#18 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(641): Stack\StackedHttpKernel->handle(Object(Illuminate\Http\Request))
#19 /home/username/webapps/site_name/public/index.php(49): Illuminate\Foundation\Application->run()
#20 {main} [] []
[2015-01-12 00:22:10] production.ERROR: exception 'Illuminate\Session\TokenMismatchException' in /home/username/webapps/site_name/app/filters.php:88
Stack trace:
#0 [internal function]: {closure}(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#1 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(199): call_user_func_array(Object(Closure), Array)
#2 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(154): Illuminate\Events\Dispatcher->fire('router.filter: ...', Array, true)
#3 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1468): Illuminate\Events\Dispatcher->until('router.filter: ...', Array)
#4 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(240): Illuminate\Routing\Router->callRouteFilter('csrf', Array, Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#5 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(114): Illuminate\Routing\ControllerDispatcher->callFilter(Array, Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#6 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(55): Illuminate\Routing\ControllerDispatcher->before(Object(AuthController), Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'postLogin')
#7 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php(962): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'AuthController', 'postLogin')
#8 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}()
#9 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Route.php(109): call_user_func_array(Object(Closure), Array)
#10 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1028): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#11 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php(996): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#12 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(775): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#13 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(745): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request))
#14 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Session/Middleware.php(72): Illuminate\Foundation\Application->handle(Object(Illuminate\Http\Request), 1, true)
#15 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Cookie/Queue.php(47): Illuminate\Session\Middleware->handle(Object(Illuminate\Http\Request), 1, true)
#16 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Cookie/Guard.php(51): Illuminate\Cookie\Queue->handle(Object(Illuminate\Http\Request), 1, true)
#17 /home/username/webapps/site_name/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Illuminate\Cookie\Guard->handle(Object(Illuminate\Http\Request), 1, true)
#18 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(641): Stack\StackedHttpKernel->handle(Object(Illuminate\Http\Request))
#19 /home/username/webapps/site_name/public/index.php(49): Illuminate\Foundation\Application->run()
#20 {main} [] []
Not even sure what TokenMismatchException has to do with the Paypal IPN since I don't have csrf enabled on the routes for it. Peep the Controller/routes below:
IpnController
use PayPal\Ipn\Listener;
use PayPal\Ipn\Message;
use PayPal\Ipn\Verifier\CurlVerifier;
class IpnController extends BaseController {
/**
* Store a newly created resource in storage.
*
* #return Response
*/
public function store()
{
$listener = new Listener;
$verifier = new CurlVerifier;
$ipnMessage = Message::createFromGlobals(); // uses php://input
$verifier->setIpnMessage($ipnMessage);
if ( Config::get( 'app.debug' ) ) {
$verifier->setEnvironment('sandbox'); // Use sandbox if debug is true
} else {
$verifier->setEnvironment('production');
}
$listener->setVerifier($verifier);
$listener->listen( function() use ( $listener )
{
// on verified IPN (everything is good!)
$resp = $listener->getVerifier()->getVerificationResponse();
$data = Input::all();
$order = new CreditOrder;
$order->txn_id = $data['txn_id'];
$order->payer_email = $data['payer_email'];
$order->user_id = $data['custom'];
$order->product_id = $data['item_number'];
$order->mc_gross = $data['mc_gross'];
$order->save();
$product = Product::find( $data['item_number'] );
$user = User::find( $data['custom'] );
$user->increment( 'credits', $product->credit_amount );
Mail::send( 'emails.credits.thankyou', [ 'username' => $user->username, 'package' => $product->product, 'credits' => $product->credit_amount, 'price' => $product->price ], function( $message ) {
$message->to( 'email#gmail.com', 'Name' )->subject( 'Name - Credits Added!' );
});
},
function() use ( $listener )
{
// on invalid IPN (somethings not right!)
$report = $listener->getReport();
$resp = $listener->getVerifier()->getVerificationResponse();
Log::error('invalid IPN');
Mail::send( 'emails.plain', [ 'content' => $report ], function( $message ) {
$message->to( 'email#gmail.com', 'Name' )->subject( 'Name Invalid IPN' );
});
});
}
public function cancel()
{
return Redirect::route( 'credits.packages' )->with( 'error', 'Your payment was canceled.' );
}
public function success()
{
return View::make( 'credits.success' );
// return Redirect::home()->with( 'success', '<strong>Thank you, '. Auth::user()->username .'!</strong> Your payment was successful and your account has been credited.' );
}
}
IPN Routes
Route::group( [ 'before' => 'auth' ], function()
{
// IPN
Route::post('/credits/ipn', [ 'uses' => 'IpnController#store', 'as' => 'credits.ipn' ] );
Route::get('/credits/cancel', [ 'uses' => 'IpnController#cancel', 'as' => 'credits.cancel' ] );
Route::post('/credits/success', [ 'uses' => 'IpnController#success', 'as' => 'credits.success' ] );
});
If you need me to add any additional info, please let me know. I've been struggling with this for a few days now and really need to get this figured out this week! Appreciate any help :)
Just by taking my IPN routes out of the "before auth" group, it seems to be working fine now?
Someone did mention something about the csrf being enabled by default on post routes. So that could have something to do with it as well. Just in case, I used their suggestion here:
http://laravel.io/forum/01-12-2015-laravel-4-paypal-ipn-not-working-tokenmismatchexception?page=1#reply-19578
All seems to be working now though.
Cheers!
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'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.
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.