public function delete() { parent::delete(); if ($contributor = $this->getContributor()) { $contributor->calcContributioncount(); } }
/** * Fetches file size if necessary. * * @override Base::save() */ public function save() { if (!$this->size) { $this->determine_file_size(); } return parent::save(); }
public function save() { global $wpdb; if (!$this->position) { $pos = $wpdb->get_var(sprintf('SELECT MAX(position)+1 FROM %s WHERE contributor_id = %d', self::table_name(), $this->contributor_id)); $this->position = $pos ? $pos : 1; } parent::save(); }
/** * @override \Podlove\Model\Base::delete(); */ public function delete() { foreach ($this->getContributions() as $contribution) { $contribution->delete(); } foreach ($this->getShowContributions() as $contribution) { $contribution->delete(); } foreach ($this->getDefaultContributions() as $contribution) { $contribution->delete(); } parent::delete(); }