Skip to content

Instantly share code, notes, and snippets.

View kschroeder's full-sized avatar

Kevin Schroeder kschroeder

View GitHub Profile
@kschroeder
kschroeder / magento-phpdoc-getter-setter-generation.php
Last active May 23, 2019 18:26
Simple script that generates the PHPDoc for methods based off of the column names in a table.
<?php
/**
* To use copy the column names from your DB and execute `php magento-phpdoc-getter-setter-generation.php <model?`
* Then paste column names into your console and hit CTRL-D
* For example
*[kschroeder@localhost tests]$ php test.php SomeModel
order_id
requester_id
decider_id
@kschroeder
kschroeder / magento-phpdoc-getter-setter-generation.php
Created May 23, 2019 18:22
Simple script that generates the PHPDoc for methods based off of the column names in a table. To use copy the column names from your DB and execute
<?php
$returnValue = $argv[1]??'void';
$output = "/**\n";
$lines = explode("\n", file_get_contents('php://stdin'));
foreach ($lines as $line) {
$column = explode(' ', $line);
$column = array_shift($column);
$generatedName = explode('_', $column);
@kschroeder
kschroeder / magento-phpdoc-getter-setter-generation.php
Created May 23, 2019 18:22
Simple script that generates the PHPDoc for methods based off of the column names in a table. To use copy the column names from your DB and execute
<?php
$returnValue = $argv[1]??'void';
$output = "/**\n";
$lines = explode("\n", file_get_contents('php://stdin'));
foreach ($lines as $line) {
$column = explode(' ', $line);
$column = array_shift($column);
$generatedName = explode('_', $column);