src/Model/Logic/EntityLogic.php
private function generateProperties(array $colSchema, string $tplDir): array
    {
        $entityConfig = [
            'tplFilename' => 'property',
            'tplDir'      => $tplDir,
        ];

        // id
        $id = !empty($colSchema['key']) ? '* @Id()' : '';

        // required
        $isRequired = $colSchema['nullable'] === 'NO' && $colSchema['default'] === null;
        $required   = !empty($colSchema['key']) ? false : $isRequired;
        $required   = ($required == true) ? '* @Required()' : '';

        // default
        $default = $this->transferDefaultType($colSchema['type'], $colSchema['key'], $colSchema['default']);
        $default = ($default !== null) ? sprintf(', default=%s', $default) : '';

        $data         = [
            'type'         => $colSchema['phpType'],
            'propertyName' => $colSchema['mappingVar'],
            'column'       => $colSchema['name'],
            'columnType'   => $colSchema['mappingType'],
            'default'      => $default,
            'required'     => $required,
            'id'           => $id,
        ];
        $gen          = new FileGenerator($entityConfig);
        $propertyCode = $gen->render($data);

        return [$propertyCode, $required];
    }
private function generateProperties(array $colSchema, string $tplDir): array
    {
        $entityConfig = [
            'tplFilename' => 'property',
            'tplDir'      => $tplDir,
        ];

        // id
        $id = !empty($colSchema['key']) ? '* @Id()' : '';

        // required
        $isRequired = $colSchema['nullable'] === 'NO' && $colSchema['default'] === null;
        $required   = !empty($colSchema['key']) ? false : $isRequired;
        $required   = ($required == true) ? '* @Required()' : '';

        // default
        $default = $this->transferDefaultType($colSchema['type'], $colSchema['key'], $colSchema['default']);
        $default = ($default !== null) ? sprintf(', default=%s', $default) : '';

        $data         = [
            'type'         => $colSchema['phpType'],
            'propertyName' => $colSchema['mappingVar'],
            'column'       => $colSchema['name'],
            'columnType'   => $colSchema['mappingType'],
            'default'      => $default,
            'required'     => $required,
            'id'           => $id,
        ];
        $gen          = new FileGenerator($entityConfig);
        $propertyCode = $gen->render($data);

        return [$propertyCode, $required];
    }
private function generateProperties ( array $ colSchema , string $ tplDir ) : array { $ entityConfig = [ 'tplFilename' => 'property' , 'tplDir' => $ tplDir , ] ; // id $ id = ! empty ( $ colSchema [ 'key' ] ) ? '* @Id()' : '' ; // required $ isRequired = $ colSchema [ 'nullable' ] === 'NO' && $ colSchema [ 'default' ] === null ; $ required = ! empty ( $ colSchema [ 'key' ] ) ? false : $ isRequired ; $ required = ( $ required == true ) ? '* @Required()' : '' ; // default $ default = $ this -> transferDefaultType ( $ colSchema [ 'type' ] , $ colSchema [ 'key' ] , $ colSchema [ 'default' ] ) ; $ default = ( $ default !== null ) ? sprintf ( ', default=%s' , $ default ) : '' ; $ data = [ 'type' => $ colSchema [ 'phpType' ] , 'propertyName' => $ colSchema [ 'mappingVar' ] , 'column' => $ colSchema [ 'name' ] , 'columnType' => $ colSchema [ 'mappingType' ] , 'default' => $ default , 'required' => $ required , 'id' => $ id , ] ; $ gen = new FileGenerator ( $ entityConfig ) ; $ propertyCode = $ gen -> render ( $ data ) ; return [ $ propertyCode , $ required ] ; }
@param array  $colSchema
@param string $tplDir

@return array
@param array $colSchema @param string $tplDir