public function save(array $data, $table = null) { if (null === $table || $table == $this->_primaryTable) { // Set total_left if (!isset($data['total_left'])) { $data['total_left'] = $data['total'] - ($data['start'] + $data['found']); } } return parent::save($data, $table); }
public function save(array $data, $table = null) { if (null === $table || $table == $this->_primaryTable) { // Set updated if (!isset($data['updated'])) { $data['updated'] = date('Y-m-d H:i:s'); } // Modify g_region, g_country_code if (isset($data['g_country_code'])) { $data['g_country_code'] = strtolower($data['g_country_code']); if ($data['g_country_code'] == 'us') { if (isset($data['g_region'])) { $data['g_region'] = strtolower($data['g_region']); } } } } return parent::save($data, $table); }