This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// In a model, far far away.... there was some DRY action | |
function doesComplexWork($id, $conditions) { | |
return "Complex shenanigans"; | |
} | |
function doesMoreComplexWork($id) { | |
return "More Complex shenanigans"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php | |
<?php | |
if (!defined('TMP')) { | |
define('TMP', getcwd() . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR); | |
} | |
$file = getcwd() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'database.php'; | |
if (!is_readable($file)) { | |
echo "Can't find database config at : $file\n"; | |
die(1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$formatter = function($entity) use ($preferredlanguage, $translatedFields) { | |
foreach ($entity->translations as $translation) { | |
if ($translation->locale === $preferredlanguage) { | |
$field = $translation->get('field'); | |
$value = $translation->get('value'); | |
$entity->set($field, $value); | |
} | |
} |