Closed GoogleCodeExporter closed 9 years ago
Hi,
Can you please post your grid code? or email it to geral[that
thing]petala-azul.com
Best Regards,
Bento Vilas Boas
Original comment by pao.fre...@gmail.com
on 22 Feb 2010 at 3:46
Hi,
Looking at getMainTable() method in Bvb_Grid_Source_Zend_Select class, we can
see
that 'table' index is created only for Zend_Db_Select objects which have a
'from'
joinType and not for others (eg. 'inner join' joinType).
My query is $this->_getDb()->select()->from('XXX');
in getMainTable() method:
- echo $this->_select echoes : SELECT `XXX`.* FROM `XXX`
- AND with Zend_debug::dump($from) I get a 'inner join' joinType :
array
'import_4' =>
array
'joinType' => string 'inner join' (length=10)
'schema' => null
'tableName' => string 'import_4' (length=8)
'joinCondition' => null
So, in this case no table can be found.
Removing the joinType condition in the foreach of the method solves the problem
(and
also the issue 174)
Original comment by tribal...@gmail.com
on 22 Feb 2010 at 4:12
Hi,
This table is used for CRUD operations. So I need to get the 'main' table for
then
insert data there.
The odd thing is that this query
$this->_db->select()->from('Country')
outputs this:
Array
(
[Country] => Array
(
[joinType] => from
[schema] =>
[tableName] => Country
[joinCondition] =>
)
)
Which version of ZF are you using?
Best Regards,
Bento Vilas Boas
Original comment by pao.fre...@gmail.com
on 22 Feb 2010 at 4:27
And the raw SQL is
SELECT `Country`.* FROM `Country`
Best Regards,
Bento Vilas Boas
Original comment by pao.fre...@gmail.com
on 22 Feb 2010 at 4:28
I'm using 1.9.2 version.
But, in general, even if that works with your query, that could not work with a
query
which has joined tables, is not it ?
If it is the case, the good way would be to keep on searching a 'join' joinType
in
the foreach, and if none was found and tables are not empty so taking the first
table.
I say "first table" to simplify, the best way would be to give possibility to
developers to specify the table they want to be the main (eg. with a join
relation,
for a grid you could want to use table as main, for crud or detail for example,
and
in another grid with the same relation you could want to specify an other table
(for
crud, details, ...)), knowing that with joins the primary key of a table is not
neccessary "unique" in query's result
Original comment by tribal...@gmail.com
on 22 Feb 2010 at 4:50
Hi,
You are right.
I've made some changes.
If $from has only one element, that's the table that will be used.
If $from has the 'joinType'=>from, that's the table that will be used.
else if will be the first element.
But I will provide a new method to specify the table for CRUD operations,
Check the revision 640
thanks,
Best Regards,
Bento Vilas Boas
Original comment by pao.fre...@gmail.com
on 22 Feb 2010 at 5:18
That works, thanks !
Original comment by tribal...@gmail.com
on 22 Feb 2010 at 5:44
Original comment by bento.vi...@gmail.com
on 3 Mar 2010 at 4:56
Original issue reported on code.google.com by
tribal...@gmail.com
on 22 Feb 2010 at 2:59