PHP code example of astraller / yii2-mongodb-embedded

1. Go to this page and download the library: Download astraller/yii2-mongodb-embedded 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/ */

    

astraller / yii2-mongodb-embedded example snippets


    public function embedAttributes() {
        return [
            'conditions' => [
                'class' => DialogConditions::class,
                'type'  => 'many',
            ],
            'text'       => [
                'class' => Text::class,
                'type'  => 'one',
            ],
            'variants' => [
                'class' => Dialog::class,
                'type' => 'manyById'
            ]
        ];
    }


namespace app\models;

use astraller\mongodb\MongoEmbedModel;

class Vector3 extends MongoEmbedModel
{

    public $x;
    public $y;
    public $z;

    public function rules()
    {
        return [
            [['x', 'y', 'z'], '