Ejemplo n.º 1
0
 /**
  * Save
  *
  */
 function save()
 {
     parent::save();
     // If more than 10 passwords, delete oldest
     $passwords = ContactPasswords::findAll(array('conditions' => array('`contact_id` = ?', $this->getContactId())));
     if (count($passwords) > 10) {
         $oldest = ContactPasswords::getOldestContactPassword($this->getContactId());
         $oldest[0]->delete();
     }
 }
Ejemplo n.º 2
0
 /**
  * Return newest contact passwords for all contacts
  *
  * @access public
  * @return array
  */
 static function getNewestContactPasswords()
 {
     return ContactPasswords::findAll(array('order' => 'password_date desc', 'group by' => 'contact_id'));
     // findAll
 }