Comments (8)
Is this still a problem?
from datatablesbundle.
Unfortunately yes.
I can use the datatable well if I only use the sort function or change the page length, or use the paginator.
But as soon as I use the search function once, any interaction (sort, page length, search etc..) throws me a 500 error "Invalid parameter number: number of bound variables does not match number of tokens"...
from datatablesbundle.
Do you have the option "searchable" or "orderable" always set to false? Then the bundle throws an error. Just try at least one field with "searchable" = true or/and "orderable" = true. Or try the default settings.
Please post your DataTables class.
from datatablesbundle.
Thanks for your help.
My settings are the default settings. Unfortunately, adding one field searchable or orderable still throws the error... I also tried forcing searching and ordering in the features with no success.
Here is my DataTables class:
namespace PJM\AppBundle\Datatables;
use Sg\DatatablesBundle\Datatable\View\AbstractDatatableView;
use PJM\AppBundle\Twig\IntranetExtension;
/**
* Class HistoriqueDatatable
*
* @package PJM\AppBundle\Datatables
*/
class HistoriqueDatatable extends AbstractDatatableView
{
/**
* {@inheritdoc}
*/
public function buildDatatableView()
{
$this->getFeatures()
->setServerSide(true)
->setProcessing(true);
$this->getOptions()
->setOrder(array("column" => 0, "direction" => "desc"))
;
$this->getAjax()->setUrl($this->getRouter()->generate('pjm_app_consos_historiqueResults'));
$this->setStyle(self::BOOTSTRAP_3_STYLE);
$this->getColumnBuilder()
->add('date', 'datetime', array(
'title' => 'Date',
'format' => 'll'
))
->add('nombre', 'column', array('title' => 'Nombre',))
->add('item.libelle', 'column', array('title' => 'Item',))
->add('item.prix', 'column', array('title' => 'Prix',))
->add('item.boquette.nom', 'column', array('title' => 'Boquette',))
;
}
/**
* {@inheritdoc}
*/
public function getLineFormatter()
{
$ext = new IntranetExtension();
$formatter = function($line) use($ext) {
$line["nombre"] = $ext->nombreFilter($line["nombre"]);
$line["item"]["prix"] = $ext->prixFilter($line["nombre"]*$line["item"]["prix"]);
return $line;
};
return $formatter;
}
/**
* {@inheritdoc}
*/
public function getEntity()
{
return 'PJM\AppBundle\Entity\Historique';
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'historique_datatable';
}
}
from datatablesbundle.
I can not reproduce the issue. Where does the problem occur (filename and line number)?
Just try only the "date" field in your class.
from datatablesbundle.
It occurs
at Paginator ->getIterator () in vendor/sg/datatablesbundle/Sg/DatatablesBundle/Datatable/Data/DatatableData.php at line 407
The error is still thrown with only the "date" field in my class.
Here is the full stack trace :
[1] Doctrine\ORM\Query\QueryException: Invalid parameter number: number of bound variables does not match number of tokens
at n/a
in C:\Users\Louis\Documents\Programmation\Sites\pjm-intranet\vendor\doctrine\orm\lib\Doctrine\ORM\Query\QueryException.php line 100
at Doctrine\ORM\Query\QueryException::invalidParameterNumber()
in C:\Users\Louis\Documents\Programmation\Sites\pjm-intranet\vendor\doctrine\orm\lib\Doctrine\ORM\Query.php line 281
at Doctrine\ORM\Query->_doExecute()
in C:\Users\Louis\Documents\Programmation\Sites\pjm-intranet\vendor\doctrine\orm\lib\Doctrine\ORM\AbstractQuery.php line 794
at Doctrine\ORM\AbstractQuery->execute(null, '3')
in C:\Users\Louis\Documents\Programmation\Sites\pjm-intranet\vendor\doctrine\orm\lib\Doctrine\ORM\AbstractQuery.php line 598
at Doctrine\ORM\AbstractQuery->getScalarResult()
in C:\Users\Louis\Documents\Programmation\Sites\pjm-intranet\vendor\doctrine\orm\lib\Doctrine\ORM\Tools\Pagination\Paginator.php line 151
at Doctrine\ORM\Tools\Pagination\Paginator->getIterator()
in C:\Users\Louis\Documents\Programmation\Sites\pjm-intranet\vendor\sg\datatablesbundle\Sg\DatatablesBundle\Datatable\Data\DatatableData.php line 407
at Sg\DatatablesBundle\Datatable\Data\DatatableData->getResponse()
in C:\Users\Louis\Documents\Programmation\Sites\pjm-intranet\src\PJM\AppBundle\Controller\ConsosController.php line 28
at PJM\AppBundle\Controller\ConsosController->historiqueResultsAction()
in line
at call_user_func_array(array(object(ConsosController), 'historiqueResultsAction'), array())
in C:\Users\Louis\Documents\Programmation\Sites\pjm-intranet\app\bootstrap.php.cache line 3008
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), '1')
in C:\Users\Louis\Documents\Programmation\Sites\pjm-intranet\app\bootstrap.php.cache line 2970
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), '1', true)
in C:\Users\Louis\Documents\Programmation\Sites\pjm-intranet\app\bootstrap.php.cache line 3119
at Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle(object(Request), '1', true)
in C:\Users\Louis\Documents\Programmation\Sites\pjm-intranet\app\bootstrap.php.cache line 2364
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
in C:\Users\Louis\Documents\Programmation\Sites\pjm-intranet\web\app_dev.php line 28
from datatablesbundle.
I can't find an issue. Maybe something is in your entity class not mapped correctly. Clear your cache.
from datatablesbundle.
I found what throws the error ! It is because I am setting parameters on the query builder, but the function setParameters clears the previous set parameters. That's a weird behaviour I didn't know of.
// HistoriqueRepository.php
public function callbackFindByUser($user)
{
return function($qb) use($user) {
$qb
->join('Historique.user', 'u', 'WITH', 'u = :user')
->setParameters(array(
'user' => $user,
))
;
};
}
setParameters
is to be replaced by setParameter
TL;DR : it is not a DataTables bug, but it may be good to notify devs in the doc about this ?
from datatablesbundle.
Related Issues (20)
- Basic sample configuration in Symfony5. Someone? HOT 3
- Custom DateTimePicker HOT 1
- Disable translation of selectFilter entries
- Showing all entries does not work HOT 2
- Edit inline selected value missing HOT 1
- Notice: Array to string conversion in search VirtualColumn HOT 4
- Calling setHint() on the Query
- Support for the v1.x HOT 4
- parent recursive
- SetMaxResult HOT 1
- Individual Filtering error HOT 1
- Array to string conversion in search VirtualColumn HOT 1
- Problem with dql, filter and global search
- Undefined constant Doctrine\DBAL\Types\Type::DATETIME HOT 4
- Bug on function getName() HOT 3
- Hidden DateTimeColumn is all empty when switched to visible until reload HOT 1
- Symfony 6.0 support HOT 3
- Search in translate value of VirtualColumn HOT 1
- Does MultiselectColumn require or use the Select extension? HOT 2
- Invalidate Result cache? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from datatablesbundle.