zf2 : join with tablegateway dont work

I tried to make a join statement with tableGateway method wich one table 'A' that retrieve a field 'bfield' from other table 'B', in this way on 'ATable' model:

public function getA($id){

    $id = (int) $id;
    $resultSet = $this->tableGateway->select( function(Select $select) use ($id) {
        $select->join( 'B' , 'B.id = A.bfield_id' , array('bfield') )
            ->where->equalTo( 'A.id' , $id );
    });

    $row = $resultSet->current();

    return $row;

}

The problema is thar it dont return the 'bfield'. There are other way to do this that work, but return a simple array, and i need that return a 'A' object because i wil bind on edit form.

Whats missing here ?

Answers


I got. I put the 'bfield' field in the model 'A' in the 'exchangeArray()' function list of vars and now it works.


Need Your Help

using split view how to load web view in detail view

detailsview uisplitviewcontroller ipad

how to initialise my detail view with webview when a table row get selected in master view...

What can a ruby gem do?

ruby-on-rails ruby rubygems ruby-on-rails-plugins

I'm working on something in ruby and trying to figure out if it can be turned into a gem. I can find documentation on how to make a gem and gem manuals, but I can't find anything that says, "here is