hihi… I realized when I read it that it could be a bit confusing.
Overall goal:
I want a page that shows the count of certain select criteria (status)
ie: Map - 4 records (with status 2)
For this I thought I can use the search function that was already implemented in Map
(when I show the index page, the grid view has this filter on "status =2"
So my idea was to call that search function with the same parameters as if I were triggering it through the index page by selecting the status manually.
To hunt down the problem I am now using
Mapcontroller:Viewaction:
public function actionView($id)
{
$model = $this->findModel($id);
$searchModel = new MapSearch();
$SearchParam['statusAttribute']= 2;
$ar['MapSearch'] = $SearchParam;
$Data = $searchModel->search($ar);
echo $Data->getTotalCount();
This code fires the exception of a missing table : Unknown column ‘en_map_table.shock’ in ‘where clause’
SELECT COUNT(*) FROM `mxp_bcmp_de_map` LEFT JOIN `mxp_bcmp_de_map` `language_map_table` ON `mxp_bcmp_de_map`.
However when I go to the indexpage and select the filter manually
then the code returns the correct data
and when I look at the db calls it did include that missing table (en_map_table)
SELECT COUNT(*) FROM `mxp_bcmp_en_map` `en_map_table` LEFT JOIN `mxp_bcmp_de_map` `language_map_table` ON `en_map_table`.`id` = `language_map_table`.`id` LEFT JOIN `mxp_generic_itemstatus`
Good to hear that you solved it, although I still don’t understand what you are doing …
There’s one thing I’m worrying about. Do you set the “from” part of the query outside of the search method before you call it? IMO it’s not a good design.