2010年8月19日星期四

[fw-db] Automatic transform and save the $_POST data

Hello my friends.

I´m developing an application to use for my graduation here in Brazil.

I was thinking in some idea to use the $db->insert($data) in a better way.

Nowadays I´m used to do this:

Zend_Loader::loadClass('News');
$db = new News();

$data = array('name' => $this->getRequest()->getPost('name'));

$db->insert($data);

Well, it works very fine, BUT, I created a stdclass() and set the database
values like public vars, like this:
public $name;

Can I just do it?

$db->insert($this);

To save all the content just one, without hading to mount the array like the
previous code?

Thanks and best regard´s
--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/Automatic-transform-and-save-the-POST-data-tp2331163p2331163.html
Sent from the Zend DB mailing list archive at Nabble.com.

没有评论: