Skip to content

Instantly share code, notes, and snippets.

View AD7six's full-sized avatar
:shipit:
Busy shippin'

Andy Dawson AD7six

:shipit:
Busy shippin'
View GitHub Profile
<?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);
}
}
#!/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);
<?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";
}