2009年7月8日星期三

[fw-db] Is the use of setIntegrityCheck(false) a good practice in classes extending Zend_Db_Table_Abstract ?

Hi,

I mostly use classes extending Zend_Db_Table for my models and as you can
imagine I often have to request data using a join query.

I was wondering if the following kind of class is a good way to achieve that
:

class Model_Topics extends Zend_Db_Table_Abstract
{
protected $_name = 'forum_topics';

public function getTopicById($topic_id)
{
$sql = $this->select()
->setIntegrityCheck(false)
->from('forums', array('name' => 'name_en',
'artist_id'))
->join('forum_topics', 'forums.forum_id =
forums_topics.forum_id')

->where($this->getAdapter()->quoteInto('forums.page_id = ?', (int)
$forum_id, 'INTEGER'))
->where('forums_topics.state = 1')
->order('forums_topics.position ASC');
}

public function updateTopic($data)
{
$topic_id = (int) $data['topic_id'];
unset($data['topic_id']);

return $this->update($data, $this->getAdapter()->quoteInto('topic_id
= ?', $topic_id, 'INTEGER'));
}
}

Thank you for your opinions/corrections and indulgence is this is really a
no-no !

Kind reguards,


V
--
View this message in context: http://www.nabble.com/Is-the-use-of-setIntegrityCheck%28false%29-a-good-practice-in-classes-extending-Zend_Db_Table_Abstract---tp24391054p24391054.html
Sent from the Zend DB mailing list archive at Nabble.com.

没有评论: