[fw-general] Problem with fetchAll of Table with Primary Keys as pair

2009-01-26 Thread atay

I have Table 
Categories_Products
{
   cat_id int
   prod_id int
   primary key (cat_id, prod_id)
}

and the class:

class Prodcat extends Zend_Db_Table  {

protected $_name = 'Categories_Products';
protected $_primary = array(prod_id, cat_id);
.

or without protected $_primary, no diffrence.

And now when I'm going to 
$pc = new Prodcat();
$where = $pc-getAdapter()-quoteInto(cat_id IN (?), explode(|,
$list));
$temp = $pc-fetchAll($where);


if THERE'S RECORDS FOUND IT'S GOOD, no problem, everything is working
excelent, but if there is NOT matching record in my database (there is no
records with cat_id from list) I got very bad error. 

I will write AGAIN, the error is ONLY when no records found.

Very bad error:
Fatal error: Uncaught exception 'Zend_Db_Statement_Exception' with message
'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error
in your SQL syntax; check the manual that corresponds to your MySQL server
version for the right syntax to use near '))' at line 1' in
D:\progs\VertrigoServ\www\cudny\library\Zend\Db\Statement\Pdo.php:238 Stack
trace: #0
D:\progs\VertrigoServ\www\cudny\library\Zend\Db\Statement.php(283):
Zend_Db_Statement_Pdo-_execute(Array) #1
D:\progs\VertrigoServ\www\cudny\library\Zend\Db\Adapter\Abstract.php(430):
Zend_Db_Statement-execute(Array) #2
D:\progs\VertrigoServ\www\cudny\library\Zend\Db\Adapter\Pdo\Abstract.php(220):
Zend_Db_Adapter_Abstract-query(Object(Zend_Db_Table_Select), Array) #3
D:\progs\VertrigoServ\www\cudny\library\Zend\Db\Table\Abstract.php(1330):
Zend_Db_Adapter_Pdo_Abstract-query(Object(Zend_Db_Table_Select)) #4
D:\progs\VertrigoServ\www\cudny\library\Zend\Db\Table\Abstract.php(1158):
Zend_Db_Table_Abstract-_fetch(Object(Zend_Db_Table_Select)) #5 D:\progs\Ver
in D:\progs\VertrigoServ\www\cudny\library\Zend\Db\Statement\Pdo.php on line
238


What can I do ? Can anyone help ? Can anyone know why it happen ?
-- 
View this message in context: 
http://www.nabble.com/Problem-with-fetchAll-of-Table-with-Primary-Keys-as-pair-tp21670110p21670110.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Problem with fetchAll of Table with Primary Keys as pair

2009-01-26 Thread atay

ok, I resolve my problem.

The problem was that $list hasn't no value so SQL was cat_id IN () so
wasn't values in ().

I got it finally :)
-- 
View this message in context: 
http://www.nabble.com/Problem-with-fetchAll-of-Table-with-Primary-Keys-as-pair-tp21670110p21674250.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend Form, Groups and decorators, how to ?

2009-01-11 Thread atay

thanks a lot, realy thanks, I modyfy Your decorators and I have my own :) 

I wanted to have all input forms in one td so I modyfy Your decorators. If
someone want to use it, here is:

-

  public $_groupDecoratorLeft = array( 
  'ViewHelper', 
  'Errors', 
  array(array('col' = 'HtmlTag'), array('tag' = 'td', 'openOnly'
= true)),
  array('Label', array('tag' = 'th')) ,
  array(array('row' = 'HtmlTag'), array('tag' = 'tr', 'openOnly'
= true)) 
   
); 

public $_groupDecoratorMiddle = array( 
  'ViewHelper', 
  'Errors', 
  array('Label', array('tag' = '')), 
); 

public $_groupDecoratorRight = array( 
  'ViewHelper', 
  'Errors', 
  array('Label', array('tag' = '')), 
  array(array('col' = 'HtmlTag'), array('tag' = 'td', 'closeOnly'
= true)), 
  array(array('row' = 'HtmlTag'), array('tag' =
'tr','closeOnly'=true)) 
);  
-- 
View this message in context: 
http://www.nabble.com/Zend-Form%2C-Groups-and-decorators%2C-how-to---tp21397914p21402448.html
Sent from the Zend Framework mailing list archive at Nabble.com.