src/Common/Console/Seed/DefaultSeed.php
protected function generate($aFields)
    {
        $aOut = [];
        foreach ($aFields as $oField) {
            switch ($oField->type) {
                case 'textarea':
                    $mValue = $this->loremParagraph();
                    break;
                case 'wysiwyg':
                    $mValue = $this->loremHtml();
                    break;
                case 'number':
                    $mValue = $this->randomInteger();
                    break;
                case 'boolean':
                    $mValue = $this->randomBool();
                    break;
                case 'datetime':
                    $mValue = $this->randomDateTime();
                    break;
                case 'date':
                    $mValue = $this->randomDateTime(null, null, 'Y-m-d');
                    break;
                case 'time':
                    $mValue = $this->randomDateTime(null, null, 'H:i:s');
                    break;
                case 'dropdown':
                    $mValue = $this->randomItem(array_keys($oField->options));
                    break;
                default:
                    $mValue = $this->loremWord(3);
                    break;
            }
            $aOut[$oField->key] = $mValue;
        }

        //  Special Cases, model dependant
        $oModel = Factory::model(static::CONFIG_MODEL_NAME, static::CONFIG_MODEL_PROVIDER);

        //  Slugs
        //  If these are being automatically generated then let the model do the hard work
        if ($oModel->isAutoSetSlugs()) {
            $sColumn = $oModel->getColumn('slug');
            unset($aOut[$sColumn]);
        }

        //  Tokens
        //  If these are being automatically generated then let the model do the hard work
        if ($oModel->isAutoSetTokens()) {
            $sColumn = $oModel->getColumn('token');
            unset($aOut[$sColumn]);
        }

        return $aOut;
    }
protected function generate($aFields)
    {
        $aOut = [];
        foreach ($aFields as $oField) {
            switch ($oField->type) {
                case 'textarea':
                    $mValue = $this->loremParagraph();
                    break;
                case 'wysiwyg':
                    $mValue = $this->loremHtml();
                    break;
                case 'number':
                    $mValue = $this->randomInteger();
                    break;
                case 'boolean':
                    $mValue = $this->randomBool();
                    break;
                case 'datetime':
                    $mValue = $this->randomDateTime();
                    break;
                case 'date':
                    $mValue = $this->randomDateTime(null, null, 'Y-m-d');
                    break;
                case 'time':
                    $mValue = $this->randomDateTime(null, null, 'H:i:s');
                    break;
                case 'dropdown':
                    $mValue = $this->randomItem(array_keys($oField->options));
                    break;
                default:
                    $mValue = $this->loremWord(3);
                    break;
            }
            $aOut[$oField->key] = $mValue;
        }

        //  Special Cases, model dependant
        $oModel = Factory::model(static::CONFIG_MODEL_NAME, static::CONFIG_MODEL_PROVIDER);

        //  Slugs
        //  If these are being automatically generated then let the model do the hard work
        if ($oModel->isAutoSetSlugs()) {
            $sColumn = $oModel->getColumn('slug');
            unset($aOut[$sColumn]);
        }

        //  Tokens
        //  If these are being automatically generated then let the model do the hard work
        if ($oModel->isAutoSetTokens()) {
            $sColumn = $oModel->getColumn('token');
            unset($aOut[$sColumn]);
        }

        return $aOut;
    }
protected function generate ( $ aFields ) { $ aOut = [ ] ; foreach ( $ aFields as $ oField ) { switch ( $ oField -> type ) { case 'textarea' : $ mValue = $ this -> loremParagraph ( ) ; break ; case 'wysiwyg' : $ mValue = $ this -> loremHtml ( ) ; break ; case 'number' : $ mValue = $ this -> randomInteger ( ) ; break ; case 'boolean' : $ mValue = $ this -> randomBool ( ) ; break ; case 'datetime' : $ mValue = $ this -> randomDateTime ( ) ; break ; case 'date' : $ mValue = $ this -> randomDateTime ( null , null , 'Y-m-d' ) ; break ; case 'time' : $ mValue = $ this -> randomDateTime ( null , null , 'H:i:s' ) ; break ; case 'dropdown' : $ mValue = $ this -> randomItem ( array_keys ( $ oField -> options ) ) ; break ; default : $ mValue = $ this -> loremWord ( 3 ) ; break ; } $ aOut [ $ oField -> key ] = $ mValue ; } //  Special Cases, model dependant $ oModel = Factory :: model ( static :: CONFIG_MODEL_NAME , static :: CONFIG_MODEL_PROVIDER ) ; //  Slugs //  If these are being automatically generated then let the model do the hard work if ( $ oModel -> isAutoSetSlugs ( ) ) { $ sColumn = $ oModel -> getColumn ( 'slug' ) ; unset ( $ aOut [ $ sColumn ] ) ; } //  Tokens //  If these are being automatically generated then let the model do the hard work if ( $ oModel -> isAutoSetTokens ( ) ) { $ sColumn = $ oModel -> getColumn ( 'token' ) ; unset ( $ aOut [ $ sColumn ] ) ; } return $ aOut ; }
Generate a new item

@param array $aFields The fields to generate

@return array
Generate a new item