join Function inserts a JOIN clause in the get()/find() method and than returns the join result in a array into the object
Ex. $obj->join(‘users’);
$obj->_users->name and $obj->_users->login (but only as object not a PhpBURN model if you want methods in user use _getLink())
@param String $tableName
@param String $fieldLeft
@param String $fieldRight
@param String $operator
@param String $joinType
@param String $tableRight
@return PhpBURN_Core
Params
$tableName
Name of the table that will receive the JOIN
$fieldLeft
The field form left side of the join ON statement
$fieldRight
Value or field on the right side of ON statement
$operator (optional)
The operator for ON statment
$joinType (optional)
JOIN, INNER JOIN, OUTTER JOIN, LEFT JOIN, RIGHT JOIN
$tableRight (optional)
When you want to use $fieldRight as a table field you should specify this param with the right table to be attached to $fieldRight field
Explanation
Many times just simple selects aren’t enough for us to do our work, so join is a real friend but many developers don’t know or are afraid of use JOIN, so now your problems are solved.
Let’s see usage examples of this method:
$user = new Users();
$user->join('albums','user','id_user','=','LEFT JOIN',$user->_tablename);
$user->find();
That will generate a SELECT with something like that “LEFT JOIN albums ON albums.user = users.id_user”
or you can use it even more SIMPLE
$user = new Users();
$user->join('albums','date',date('Y-m-d'));
$user->find();
That will generate a SELECT with something like that “JOIN albums ON albums.date = ’2010-06-27′” in my case
Once more… BE CREATIVE
