Skip to content
Permalink
Browse files

Clean up code a bit.

Remove bonus ternary and array modification.
  • Loading branch information...
markstory committed Aug 24, 2014
1 parent 44fee92 commit 6087c0c0f87dc3f720abd06113f339f41d51b609
Showing with 7 additions and 8 deletions.
  1. +7 −8 src/ORM/Association.php
@@ -594,22 +594,21 @@ protected function _dispatchBeforeFind($query) {
* @return void
*/
protected function _appendFields($query, $surrogate, $options) {
$options['fields'] = $surrogate->clause('select') ?: $options['fields'];
$fields = $surrogate->clause('select') ?: $options['fields'];
$target = $this->_targetTable;
$autoFields = $surrogate->autoFields();
if (empty($options['fields']) && !$autoFields) {
$f = isset($options['fields']) ? $options['fields'] : null;
if ($options['includeFields'] && ($f === null || $f !== false)) {
$options['fields'] = $target->schema()->columns();
if (empty($fields) && !$autoFields) {
if ($options['includeFields'] && ($fields === null || $fields !== false)) {
$fields = $target->schema()->columns();
}
}
if ($autoFields === true) {
$options['fields'] = array_merge((array)$options['fields'], $target->schema()->columns());
$fields = array_merge((array)$fields, $target->schema()->columns());
}
if (!empty($options['fields'])) {
$query->select($query->aliasFields($options['fields'], $target->alias()));
if (!empty($fields)) {
$query->select($query->aliasFields($fields, $target->alias()));
}
}

0 comments on commit 6087c0c

Please sign in to comment.
You can’t perform that action at this time.