<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PhpBURN - The Kick-Ass PHP Framework</title>
	<atom:link href="http://www.phpburn.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.phpburn.com</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Mon, 23 Aug 2010 21:59:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>PhpBURN Forum Beta</title>
		<link>http://www.phpburn.com/2010/08/23/phpburn-forum-beta/</link>
		<comments>http://www.phpburn.com/2010/08/23/phpburn-forum-beta/#comments</comments>
		<pubDate>Mon, 23 Aug 2010 21:59:41 +0000</pubDate>
		<dc:creator>klederson</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[community]]></category>
		<category><![CDATA[faq]]></category>
		<category><![CDATA[forum]]></category>
		<category><![CDATA[people]]></category>

		<guid isPermaLink="false">http://www.phpburn.com/?p=137</guid>
		<description><![CDATA[We created a PhpBURN Forum to bring people closer to talk and ask about PhpBURN features and more. Check it out at http://forum.phpburn.com]]></description>
			<content:encoded><![CDATA[<p>We created a PhpBURN Forum to bring people closer to talk and ask about PhpBURN features and more.</p>
<p>Check it out at http://forum.phpburn.com</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpburn.com/2010/08/23/phpburn-forum-beta/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Multiple DBMS (databases) as One</title>
		<link>http://www.phpburn.com/2010/08/06/using-multiple-databases-as-one/</link>
		<comments>http://www.phpburn.com/2010/08/06/using-multiple-databases-as-one/#comments</comments>
		<pubDate>Fri, 06 Aug 2010 14:52:30 +0000</pubDate>
		<dc:creator>klederson</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://www.phpburn.com/?p=138</guid>
		<description><![CDATA[How to extend models from different databases Using PhpBURN you can extend a MySQL model using a MSSQL model&#8230; how? Let me show you: In system/config/model.php you can configure as many packages you want with lots of information such as host, database, username, password, dialect, etc&#8230; So let&#8217;s use an example using two packages, the [...]]]></description>
			<content:encoded><![CDATA[<p>How to extend models from different databases</p>
<p>Using PhpBURN you can extend a MySQL model using a MSSQL model&#8230; how? Let me show you:</p>
<p>In system/config/model.php you can configure as many packages you want with lots of information such as host, database, username, password, dialect, etc&#8230; </p>
<p>So let&#8217;s use an example using two packages, the first one will be a MySQL package running in our localhost machine and the second one will be a MSSQL package running on 192.168.0.100.</p>
<pre name='code' class='php'>
$thisConfig = array(
		/**
		 * Database configuration ( Default )
		 *
		 * This configuration will be used by defaul when
		 * package configs are not setted up
		 */
		'dialect' => 'MySQL',
		'database' => 'mysqlBurnTest',
		'user' => 'phpburn',
		'password' => 'phpburn',
		'port' => '3306',
		'host' => 'localhost',

		/**
		 * Structure configuration
		 */
		'class_path' => SYS_MODEL_PATH,

		/**
		 * database-options changes according to the database used
		 * So if you want to know what options have each database please
		 * look at documentation in section Dialects
		 *
		 * OPTIONAL
		 */
		'database_options' => array(),

		/**
		 * options are general configs for the project
		 * See Configuration section at documentation for more information
		 *
		 * OPTIONAL
		 */
		'options' => array(),

			'packages' => array(
				'mysqlPackage',
                'mssqlPackage' => array(
					'dialec' => 'MSSQL',
                    'database' => 'mssqlBurnTest',
					'host' => 192.168.0.100,
					'username' => 'sa',
					'password' => 'phpburn' //note that i dont need to put here a data that is already configured on default configs ( above ) but i will set it anyway
                )
			)
);
</pre>
<p>Well now we have our database configured and all packages configureds let&#8217;s go to system/model/mysqlPackage/ and create our model PersonalData:</p>
<pre name='code' class='php'>
	class Personaldata extends PhpBURN_Core {
	public $_tablename = "PersonalData";
	public $_package = "mysqlPackage";

	  public $idPersonalData;
	  public $name;
	  public $lastName;
	  public $birthday;
	  public $createdAt;

	public function _mapping() {
	     $this->getMap()->addField( "idPersonalData","idPersonalData", "int", 11, array("primary" => 1, "not_null" => 1, "auto_increment" => 1) );
	     $this->getMap()->addField( "name","name", "varchar", 45, array("not_null" => 1) );
	     $this->getMap()->addField( "lastName","lastName", "varchar", 45, array("not_null" => 1) );
		 $this->getMap()->addField( "birthday","birthday", "datetime", null, array("not_null" => 1) );
	     $this->getMap()->addField( "createdAt","createdAt", "timestamp", null, array("not_null" => 1, "default_value" => 'CURRENT_TIMESTAMP') );
	}
}
</pre>
<p>Well, now we have all set for MySQL model, let&#8217;s extend it using a MSSQL model and persist all data transparently it means you will use two models at same time, connecting to different tables in different database in different hosts, etc&#8230;.</p>
<p>Creating MSSQL Model Users at system/model/mssqlPackage/</p>
<pre name='code' class='php'>
	class Users extends PersonalData {
	public $_tablename = "Users";
	public $_package = "mssqlPackage";

	  public $idUsers;
	  public $login;
	  public $password;
	  public $idPersonalData;
	  public $createdAt;

	public function _mapping() {
	     $this->getMap()->addField( "idUsers","idUsers", "int", 11, array("primary" => 1, "not_null" => 1, "auto_increment" => 1) );
		 $this->getMap()->addField( "idPersonalData","idPersonalData", "int", 11, array("not_null" => 1) );
	     $this->getMap()->addField( "login","login", "varchar", 255, array("not_null" => 1) );
	     $this->getMap()->addField( "password","password", "varchar", 255, array("not_null" => 1) );
	     $this->getMap()->addField( "createdAt","createdAt", "datetime", null, array("not_null" => 1, "default_value" => 'NOW()') );

		 $this->getMap()->addParentField('idPersonalData'); //Here the magic happens
	}
}
</pre>
<p>Now if you just do:</p>
<pre name='code' class='php'>
$user = new Users();

$user->login = 'klederson';
$user->password = 'phpburn';
$user->name = 'Klederson';
$user->lastName = 'Bueno';
$user->birthday = '1986-05-17';

$user->save();
</pre>
<p>It will save in both tables, reference one to another and if you do a $user->get($pk); it will bring all information as you are working in one table. It can be pretty handy on Legacy systems or even in integration between different systems using different databases.</p>
<p>That&#8217;s all for now&#8230; Be happy <img src='http://www.phpburn.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpburn.com/2010/08/06/using-multiple-databases-as-one/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL Reverse Engineer &#8211; Beta</title>
		<link>http://www.phpburn.com/2010/08/05/mysql-reverse-engineer-beta/</link>
		<comments>http://www.phpburn.com/2010/08/05/mysql-reverse-engineer-beta/#comments</comments>
		<pubDate>Thu, 05 Aug 2010 11:57:42 +0000</pubDate>
		<dc:creator>klederson</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://www.phpburn.com/?p=136</guid>
		<description><![CDATA[We&#8217;ve added a nice MySQL Reverse Engineer Beta support and after feedbacks about this improvement we will extend it to all current drivers and also to new ones ( Oracle, SQLite and Mongo ). To work with reverse engineer is pretty easy, you just run reverse.php that is already in you generated application or create [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve added a nice MySQL Reverse Engineer Beta support and after feedbacks about this improvement we will extend it to all current drivers and also to new ones ( Oracle, SQLite and Mongo ).</p>
<p>To work with reverse engineer is pretty easy, you just run reverse.php that is already in you generated application or create a script with this content:</p>
<pre name='code' class='php'>
################################
# Hooks
################################
define('SYS_USE_FIREPHP',true,true);

################################
# Including required files
################################
require_once('app/phpBurn.php');
require_once('config.php');

//Migrations tool
PhpBURN::load('Migrations.Reverse');

################################
# Starting application
################################
PhpBURN_Reverse::init();
</pre>
<p>PS: Many to many relationships should be written in the MySQL standars: ( Tablename_has_OtherTablename ) and than magic happens</p>
<p>Than you just run this script and all your configured packages and databases will be created ( don&#8217;t forget to chmod 777 your model folders ).</p>
<p>Let&#8217;s test it, more options and a graphical interface are comming soon.</p>
<p>Well folks, that is it for now, we are accepting contributions anyhow ( money, work, etc ).</p>
<p>PhpBURN group at Google Groups: <a href="http://groups.google.com/group/phpburn">http://groups.google.com/group/phpburn</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpburn.com/2010/08/05/mysql-reverse-engineer-beta/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PhpBURN vs Doctrine &#8211; Setting, Retreiving, Finding and More</title>
		<link>http://www.phpburn.com/2010/07/15/phpburn-doctrine-setting-retreiving-finding/</link>
		<comments>http://www.phpburn.com/2010/07/15/phpburn-doctrine-setting-retreiving-finding/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 13:23:16 +0000</pubDate>
		<dc:creator>klederson</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[active record]]></category>
		<category><![CDATA[dao]]></category>
		<category><![CDATA[data mapper]]></category>
		<category><![CDATA[doctrine]]></category>
		<category><![CDATA[fast]]></category>
		<category><![CDATA[faster]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[oo]]></category>
		<category><![CDATA[orm]]></category>
		<category><![CDATA[phpburn]]></category>

		<guid isPermaLink="false">http://www.phpburn.com/?p=133</guid>
		<description><![CDATA[Now we are going to show the differences between PhpBURN vs Doctrine when we are trying to work with it, search, find, get, set things into the database. First let&#8217;s see PhpBURN in action: /* PhpBURN */ $user = new User(); $user->username = 'john'; $user->password = 'password'; $user->save(); $user->username = 'john'; $user->find(); echo $user->username; // [...]]]></description>
			<content:encoded><![CDATA[<p>Now we are going to show the differences between PhpBURN vs Doctrine when we are trying to work with it, search, find, get, set things into the database.</p>
<p>First let&#8217;s see PhpBURN in action:</p>
<pre name='code' class='php'>
/*
	PhpBURN
*/
$user = new User();
$user->username = 'john';
$user->password = 'password';
$user->save();

$user->username = 'john';
$user->find();

echo $user->username; // prints 'john'

echo $user->find(); // echo '2''

while($user->fetch()) {
	echo $user->username;
}
</pre>
<pre name='code' class='php'>
/*
	DOCTRINE
*/
$user = new User();
$user->username = 'john';
$user->setPassword('password');
$user->save();

$userTable = Doctrine_Core::getTable('User');
$user = $userTable->findOneByUsername('john');

echo $user->username; // prints 'john'

$users = $userTable->retrieveAll();

echo $users->count(); // echo '2''
foreach ($users as $user)
{
  echo $user->username;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.phpburn.com/2010/07/15/phpburn-doctrine-setting-retreiving-finding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PhpBURN vs Doctrine &#8211; Model Construction</title>
		<link>http://www.phpburn.com/2010/07/15/phpburn-doctrine-model-construction/</link>
		<comments>http://www.phpburn.com/2010/07/15/phpburn-doctrine-model-construction/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 13:12:32 +0000</pubDate>
		<dc:creator>klederson</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[active record]]></category>
		<category><![CDATA[dao]]></category>
		<category><![CDATA[data mapper]]></category>
		<category><![CDATA[doctrine]]></category>
		<category><![CDATA[fast]]></category>
		<category><![CDATA[faster]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[oo]]></category>
		<category><![CDATA[orm]]></category>
		<category><![CDATA[phpburn]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://www.phpburn.com/?p=132</guid>
		<description><![CDATA[I&#8217;m going to do a little comparative between PhpBURN vs Doctrine, showing strongest points in PhpBURN in relation to that we consider the bigest ORM framework in market. The goal here it&#8217;s to show that when you use PhpBURN you have already set all your needs like persistend methods and all &#8220;stuff&#8221; then you don&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m going to do a little comparative between PhpBURN vs Doctrine, showing strongest points in PhpBURN in relation to that we consider the bigest ORM framework in market.</p>
<p>The goal here it&#8217;s to show that when you use PhpBURN you have already set all your needs like persistend methods and all &#8220;stuff&#8221; then you don&#8217;t need to keep setting facade methods, you just go using them.</p>
<p>First of all let&#8217;s see how to build a EXTENDABLE Model in PhpBURN:</p>
<pre name='code' class='php'>
class BaseUser extends PhpBURN_Core {
	public $_tablename = 'users';
	public $_package = 'phpburn';

	public function _mapping() {
		$this->getMap()->addField('id','id','int',4,array('primary' => true, 'autoincrement' => true));
		$this->getMap()->addField('username', 'username', 'varchar', 255, array());
		$this->getMap()->addField('password', 'password', 'varchar', 255, array());

		$this->getMap()->addRelationship('Groups',self::ONE_TO_MANY,'UserGroup','id','user_id');
	}
}

class User extends BaseUser {

}

/* You do Not need any more configuration because the PhpBURN works as ORM, DAO, ActiveRecord and DataMapper, you're all set
</pre>
<p>Now le&#8217;ts see it&#8217;s equivalent in Doctrine:</p>
<pre name='code' class='php'>
/**
 * This class has been auto-generated by the Doctrine ORM Framework
 */
abstract class BaseUser extends Doctrine_Record
{

  public function setTableDefinition()
  {
    $this->setTableName('user');
    $this->hasColumn('id', 'integer', 4, array('primary' => true, 'autoincrement' => true));
    $this->hasColumn('username', 'string', 255);
    $this->hasColumn('password', 'string', 255);
  }

  public function setUp()
  {
    $this->hasMany('Group as Groups', array('refClass' => 'UserGroup',
                                            'local' => 'user_id',
                                            'foreign' => 'group_id'));

    $this->hasMany('UserGroup', array('local' => 'id',
                                      'foreign' => 'user_id'));
  }

}

// Add custom methods to system/application/models/User.php

/**
 * This class has been auto-generated by the Doctrine ORM Framework
 */
class User extends BaseUser
{
  public function setPassword($password)
  {
    $this->password = md5($password);
  }
}

/**
 * This class has been auto-generated by the Doctrine ORM Framework
 */
class UserTable extends Doctrine_Table
{
  public function retrieveAll()
  {
    $query = new Doctrine_Query();
    $query->from('User u');
    $query->orderby('u.username ASC');

    return $query->execute();
  }
}
</pre>
<p>Both frameworks has Reverse Engineer and Foward Engineer to create Model and Database Tables.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpburn.com/2010/07/15/phpburn-doctrine-model-construction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wellcome to PhpBURN&#8217;s World</title>
		<link>http://www.phpburn.com/2010/06/28/wellcome-to-phpburns-world/</link>
		<comments>http://www.phpburn.com/2010/06/28/wellcome-to-phpburns-world/#comments</comments>
		<pubDate>Mon, 28 Jun 2010 15:35:55 +0000</pubDate>
		<dc:creator>klederson</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://www.phpburn.com/?p=124</guid>
		<description><![CDATA[Wellcome to PhpBURN's World]]></description>
			<content:encoded><![CDATA[<p>Wellcome to PhpBURN&#8217;s World</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpburn.com/2010/06/28/wellcome-to-phpburns-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

