underscoreToCamelCase example

protected function getPropertyNameOfColumnName($table$column)
    {
        $foreignKey = $this->getColumnForeignKey($table$column);
        if ($foreignKey instanceof \Doctrine\DBAL\Schema\ForeignKeyConstraint) {
            $table = $foreignKey->getForeignTableName();

            $fullName = $this->getClassNameOfTableName($table);

            return lcfirst($fullName) . 'Id';
        }

        return lcfirst($this->underscoreToCamelCase($column->getName()));
    }

    /** * Converts underscore separated string into a camelCase separated string * * @param string $str * * @return string */
    protected function underscoreToCamelCase($str)
    {
        

    private function getColumns()
    {
        $columns = $this->connection->query('SHOW COLUMNS FROM s_articles_attributes')->fetchAll(PDO::FETCH_ASSOC);

        $columns = array_column($columns, 'Field');

        $mapping = [];
        foreach ($columns as $column) {
            $mapping[$column] = $column;
            $camelCase = $this->underscoreToCamelCase($column);
            $mapping[$camelCase] = $column;
        }

        return $mapping;
    }

    /** * @param string $underscored * * @return string */
    

    private function getColumns()
    {
        $columns = $this->connection->query('SHOW COLUMNS FROM s_articles_attributes')->fetchAll(PDO::FETCH_ASSOC);

        $columns = array_column($columns, 'Field');

        $mapping = [];
        foreach ($columns as $column) {
            $mapping[$column] = $column;
            $camelCase = $this->underscoreToCamelCase($column);
            $mapping[$camelCase] = $column;
        }

        return $mapping;
    }

    /** * @param string $str * * @return string */
    
Home | Imprint | This part of the site doesn't use cookies.