addFilterColumn() causes fatal error


#1

Hi!

When I try to use addFilterColumn() for even a simple example I get the following:

PHP Fatal error: Cannot use atk4\ui\TableColumn\FilterModel\Generic as Generic because the name is already in use in E:\inetpub\wwwroot\pfd\app\agiletoolkit\vendor\atk4\ui\src\TableColumn\FilterPopup.php on line 10

Here is my code:

require '../agiletoolkit/vendor/autoload.php';
require 'common.php';
require 'layout.php';

$view = $app->add('View', ['ui' => 'basic segment']);
$g = $view->add(['Grid']);
$m_myModel = new myModel($db);

$g->setModel($m_myModel);
$g->addFilterColumn();

If I remove the $g->addFilterColumn() line I get a nice working table.


#2

I renamed some of the variables and files and that fixed the problem. For anyone else struggling:

  1. In agiletoolkit\vendor\atk4\ui\src\TableColumn\FilterPopup.php, rename all instances of “Generic” to something else (I renamed to “FilterGeneric”)
  2. In agiletoolkit\vendor\atk4\ui\src\TableColumn\FilterModel, rename “Generic.php” to “FilterGeneric.php”
  3. Copy “TypeString.php” and paste a copy of that file as “TypeText.php”
  4. In every file in agiletoolkit\vendor\atk4\ui\src\TableColumn\FilterModel, rename all instances of “Generic” to “FilterGeneric”

#3

Seems like namespace issue. If you could submit a pull request to fix this or perhaps even a code snippet that I can add into demos/ which triggers the error - it would be helpful.


#4

Okay I’m working on one (am new to github) I’ll get the pull request ready soon,