The Tokenizable behavior automatically saves a random token string.
array(
'Model\Article' => array(
'fields' => array(
'field' => 'string',
),
'behaviors' => array(
array(
'class' => 'Mongator\Behavior\Tokenizable',
'options' => array(
'length' => 5
)
),
),
),
);
field
(default 'token'): field used to store the hashlength
(default 10): the length of the token
$article = $mongator->create('Model\Article')->setTitle('Mongator')->save();
echo $article->getToken(); // 9b02d