PHP code example of consultnn / yii2-behaviors
1. Go to this page and download the library: Download consultnn/yii2-behaviors library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
consultnn / yii2-behaviors example snippets
public function behaviors()
{
return [
[
'class' => AttributeTypeBehavior::className(),
'attributes' => [
'_id' => AttributeTypeBehavior::TYPE_MONGO_ID,
'attribute1' => [AttributeTypeBehavior::TYPE_ARRAY_OF => AttributeTypeBehavior::TYPE_INTEGER]
]
]
];
}
private function setMongoDate(&$value)
{
$value = new \MongoDate(strtotime($value));
}