Skip to content

Instantly share code, notes, and snippets.

@renepardon
Created September 3, 2011 10:45
Show Gist options
  • Save renepardon/1190999 to your computer and use it in GitHub Desktop.
Save renepardon/1190999 to your computer and use it in GitHub Desktop.
ORM or just Zend_Db_Tabble?
<?php
$this->_em->setTable('user'); // Sets DbTable-class to use.
$users = $this->_em->findById(1); // Returns a collection of users found.
$user = $users->first(); // Get only the first user.
$user->setFirstname('Max');
$user->setLastname('Mustermann');
$this->_em->save($user); // Update user information.
@rtreffer
Copy link

rtreffer commented Sep 3, 2011

_em->find('Entity_User', 1); // retrieve the user entity $user->setFirstname('Max')->setLastname('Mustermann'); // a data model is nicer with chaining $this->_em->flush(); // save all pending changes

@renepardon
Copy link
Author

Mh, stimmt. Fluent interface und so :)
save() hingegen kann bisher nur eine Änderung speichern. Vorerst müsste das reichen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment