private function checksTable($classname, array $fields)
    {
        $schemaManager = $this->em->getConnection()->getSchemaManager();
        $metadata = $this->em->getClassMetadata($classname);
        $tableName = $metadata->getTableName();

        $this->writeln(sprintf('<info>Checking %s table</info>', $tableName), OutputInterface::VERBOSITY_VERBOSE);
        $this->write(sprintf(' - Existing table `%s` - ', $tableName), false, OutputInterface::VERBOSITY_VERY_VERBOSE);

        $requiredFields = [];
        foreach ($fields as $field) {
            if ('*' === substr($field, 0, 1)) {
                $columnName = $metadata->getSingleAssociationJoinColumnName(str_replace(['*', '_uid'], ['_', ''], $field));
            } else {
                $columnName = $metadata->getColumnName('_' . $field);
            }

            $requiredFields[$field] = $columnName;
        }

        $existingFields = array_keys($schemaManager->listTableColumns($tableName));
        $missingFields = array_diff($requiredFields, $existingFields);

        if (1 < count($missingFields)) {
            throw new \RuntimeException(sprintf('The table `%s` exists but is not up-to-date, please launch `bbapp:update` command.', $tableName));
        }

        $this->writeln('<info>OK</info>', OutputInterface::VERBOSITY_VERY_VERBOSE);

        return $this;
    }
private function checksTable($classname, array $fields)
    {
        $schemaManager = $this->em->getConnection()->getSchemaManager();
        $metadata = $this->em->getClassMetadata($classname);
        $tableName = $metadata->getTableName();

        $this->writeln(sprintf('<info>Checking %s table</info>', $tableName), OutputInterface::VERBOSITY_VERBOSE);
        $this->write(sprintf(' - Existing table `%s` - ', $tableName), false, OutputInterface::VERBOSITY_VERY_VERBOSE);

        $requiredFields = [];
        foreach ($fields as $field) {
            if ('*' === substr($field, 0, 1)) {
                $columnName = $metadata->getSingleAssociationJoinColumnName(str_replace(['*', '_uid'], ['_', ''], $field));
            } else {
                $columnName = $metadata->getColumnName('_' . $field);
            }

            $requiredFields[$field] = $columnName;
        }

        $existingFields = array_keys($schemaManager->listTableColumns($tableName));
        $missingFields = array_diff($requiredFields, $existingFields);

        if (1 < count($missingFields)) {
            throw new \RuntimeException(sprintf('The table `%s` exists but is not up-to-date, please launch `bbapp:update` command.', $tableName));
        }

        $this->writeln('<info>OK</info>', OutputInterface::VERBOSITY_VERY_VERBOSE);

        return $this;
    }
private function checksTable ( $ classname , array $ fields ) { $ schemaManager = $ this -> em -> getConnection ( ) -> getSchemaManager ( ) ; $ metadata = $ this -> em -> getClassMetadata ( $ classname ) ; $ tableName = $ metadata -> getTableName ( ) ; $ this -> writeln ( sprintf ( '<info>Checking %s table</info>' , $ tableName ) , OutputInterface :: VERBOSITY_VERBOSE ) ; $ this -> write ( sprintf ( ' - Existing table `%s` - ' , $ tableName ) , false , OutputInterface :: VERBOSITY_VERY_VERBOSE ) ; $ requiredFields = [ ] ; foreach ( $ fields as $ field ) { if ( '*' === substr ( $ field , 0 , 1 ) ) { $ columnName = $ metadata -> getSingleAssociationJoinColumnName ( str_replace ( [ '*' , '_uid' ] , [ '_' , '' ] , $ field ) ) ; } else { $ columnName = $ metadata -> getColumnName ( '_' . $ field ) ; } $ requiredFields [ $ field ] = $ columnName ; } $ existingFields = array_keys ( $ schemaManager -> listTableColumns ( $ tableName ) ) ; $ missingFields = array_diff ( $ requiredFields , $ existingFields ) ; if ( 1 < count ( $ missingFields ) ) { throw new \ RuntimeException ( sprintf ( 'The table `%s` exists but is not up-to-date, please launch `bbapp:update` command.' , $ tableName ) ) ; } $ this -> writeln ( '<info>OK</info>' , OutputInterface :: VERBOSITY_VERY_VERBOSE ) ; return $ this ; }
Checks for an existing table for entity.

@param  string $classname
@param  array  $fields

@return UpdateUsersRightsCommand

@throws \RuntimeException
Checks for an existing table for entity .