public function save(array $properties, $key = null, array $options = []) { if (empty($properties['slug'])) { $properties['slug'] = \ICanBoogie\normalize($properties['name']); } return parent::save($properties, $key, $options); }
public function save(array $properties, $key = null, array $options = array()) { if (!$key && empty($properties['uuid'])) { $properties['uuid'] = $this->generate_uuid(); } return parent::save($properties, $key, $options); }
/** * Overwrites the `constructor` property of new records. */ public function save(array $properties, $key = null, array $options = array()) { if (!$key && empty($properties[self::T_CONSTRUCTOR])) { $properties[self::T_CONSTRUCTOR] = $this->constructor; } return parent::save($properties, $key, $options); }
/** * Adds the `status` and `notify` properties if they are not defined, they default to * `pending` and `no`. * * @throws \InvalidArgumentException if the value of the `notify` property is not one of `no`, * `yes`, `author` or `done`. */ public function save(array $properties, $key = null, array $options = array()) { $properties += array(Comment::CREATED => DateTime::now(), Comment::STATUS => 'pending', Comment::NOTIFY => 'no'); if (!in_array($properties[Comment::NOTIFY], array('no', 'yes', 'author', 'done'))) { throw new \InvalidArgumentException(\ICanBoogie\format('Invalid value for property %property: %value', array('%property' => Comment::NOTIFY, '%value' => $properties[Comment::NOTIFY]))); } return parent::save($properties, $key, $options); }
/** * If the `termslug` property is empty it is created from the `term` property, otherwise * the it is normalized. */ public function save(array $properties, $key = null, array $options = array()) { if (isset($properties[Term::TERM]) && empty($properties[Term::TERMSLUG])) { $properties[Term::TERMSLUG] = \Icybee\slugize($properties[Term::TERM]); } else { if (isset($properties[Term::TERMSLUG])) { $properties[Term::TERMSLUG] = \ICanBoogie\normalize($properties[Term::TERMSLUG]); } } return parent::save($properties, $key, $options); }