Skip to content

Instantly share code, notes, and snippets.

@nsanden
Created August 17, 2015 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nsanden/eabb8335490acd6bb5a7 to your computer and use it in GitHub Desktop.
Save nsanden/eabb8335490acd6bb5a7 to your computer and use it in GitHub Desktop.
public function actionTest()
{
$n = new \common\models\Campaign;
$n->url = 'blargh';
$n->save(false);
}
public function behaviors()
{
return [
'timestamp' => [
'class' => TimestampBehavior::className(),
],
[
'class' => \yii\behaviors\SluggableBehavior::className(),
'attribute' => 'url',
'slugAttribute' => 'slug',
'immutable' => true,
'ensureUnique'=>true,
],
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment