Skip to content

Commit

Permalink
Make debugInfo methods more resilient.
Browse files Browse the repository at this point in the history
Make the debugInfo methods for ORM\Table and ORM\Query not fail when
they are used on partially complete objects.

Refs #7290
  • Loading branch information
markstory committed Sep 16, 2015
1 parent 4216736 commit d068308
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/ORM/Query.php
Expand Up @@ -826,8 +826,8 @@ public function __debugInfo()
'buffered' => $this->_useBufferedResults,
'formatters' => count($this->_formatters),
'mapReducers' => count($this->_mapReduce),
'contain' => $eagerLoader->contain(),
'matching' => $eagerLoader->matching(),
'contain' => $eagerLoader ? $eagerLoader->contain() : [],
'matching' => $eagerLoader ? $eagerLoader->matching() : [],
'extraOptions' => $this->_options,
'repository' => $this->_repository
];
Expand Down
6 changes: 4 additions & 2 deletions src/ORM/Table.php
Expand Up @@ -2203,13 +2203,15 @@ public function buildRules(RulesChecker $rules)
public function __debugInfo()
{
$conn = $this->connection();
$associations = $this->_associations ?: false;
$behaviors = $this->_behaviors ?: false;
return [
'registryAlias' => $this->registryAlias(),
'table' => $this->table(),
'alias' => $this->alias(),
'entityClass' => $this->entityClass(),
'associations' => $this->_associations->keys(),
'behaviors' => $this->_behaviors->loaded(),
'associations' => $associations ? $associations->keys() : false,
'behaviors' => $behaviors ? $behaviors->loaded() : false,
'defaultConnection' => $this->defaultConnectionName(),
'connectionName' => $conn ? $conn->configName() : null
];
Expand Down

0 comments on commit d068308

Please sign in to comment.