dudapiotr/ZfTable — pull request #37 by alihammad-gist (2014-10-17 21:32:13+00:00)
Title: Removed extra dot from '.columnName' if tableAlias was not present

Also added the ability to reference nested "aliased" results generated by queries like below. I have not changed the behavior which was present already. Sorry for un-necessary conflicts because of my auto formatting tool .

```
Select r as rank, COUNT(m) as members_count FROM Staff\Entity\Rank r LEFT JOIN r.members as m GROUP BY r.id
```

Sample result set.
```
array(2) {
[0]=>
array(2) {
["rank"]=>
string(17) "Staff\Entity\Rank"
["members_count"]=>
string(1) "4"
}
[1]=>
array(2) {
["rank"]=>
string(17) "Staff\Entity\Rank"
["members_count"]=>
string(1) "4"
}
}
```

As you can see the immediate child of top-level array is another array not the entity itself. Below is a sample DataTable for queries like this.
```
true,
'showQuickSearch' => false,
'showItemPerPage' => false,
'showColumnFilters' => false,
);

// Definition of headers
protected $headers = array(
'id' => array(
'tableAlias' => 'rank',
'title' => 'Id',
),
'title' => array(
'tableAlias' => 'rank',
'title' => 'Title',
),
'members_count' => array(
'title' => 'Number of Assignees',
),
'actions' => array(
'tableAlias' => 'rank',
'title' => 'Actions',
'width' => '170',
'sortable' => false,
),
);

// table classes
protected $class = array('table', 'table-condensed', 'table-hover', 'table-striped', 'dataTable');

public function init()
{

/**
*
* @var UrlPlugin
*/
$urlPlugin = $this->getUrlPlugin();

// Actions Delete / Edit
$this->getHeader('actions')->getCell()->addDecorator('callable', array(
'callable' => function ($context, $record) use ($urlPlugin) {
$record = $record['rank'];// <-- using alias
// rank MD is unedit/delete-able
if ($record->getTitle() == 'MD') {
return '"Default Rank"';
}

$editUrl = $urlPlugin('zfcadmin/staff/rank/edit', array(
'rankId' => $record->getId()
));
$deleteUrl = $urlPlugin('zfcadmin/staff/rank/delete', array(
'rankId' => $record->getId()
));
$rankTitle = $record->getTitle();
return '
Edit

Remove

';
}
));

// // Ranks
// $this->getHeader('members_count')->getCell()->addDecorator('callable', array(
// 'callable' => function ($context, $record) {
// $collection = $record->getMembers();
// return count($collection);
// }
// ));
}

public function setUrlPlugin(UrlPlugin $urlPlugin)
{
$this->urlPlugin = $urlPlugin;
}

protected function getUrlPlugin()
{
return $this->urlPlugin;
}
}
```