Configuring Reactor

We're almost to the point where we can write some code.  However, before we can do this, we'll need to create a Reactor.xml configuration file.

 

The configuration provides Reactor with quite a bit of information.  In particular, all of the information you setup in the Getting Started section.  The configuration file is also used to inform Reactor of relationships between tables and views in the database (herein known generically as objects).

 

My configuration file looks like this:

 

<reactor>
  <config>
       <project value="Scratch" />
       <dsn value="Scratch" />
       <type value="mssql" />
       <mapping value="/ScratchData" />
       <mode value="development" />
  </config>

  <objects/>
</reactor>

 

The tags, which are explained in detail the Reactor.xml Configuration File section, serve the following purposes:

 

Project – This is a unique name given to your application.  Reactor uses this to generate certain core files.  Once you pick this name for an application changing it will cause errors.

 

Dsn – This tells Reactor which datasource to use.  Because I named my data source Scratch, that's what I provided.

 

Type – This is the type of database that Reactor is connecting to.  My database is a Microsoft SQL database so I've provided "mssql". All of the available options are outlined in the Reactor.xml Configuration File section.

 

Mapping – This is the mapping to the directory where Reactor will write generated files.  This must be a mapping or located the root of your website.  

 

Note: Reactor does not require any mappings!  Don't listen to people who tell you otherwise.

 

Mode – Without getting into detail, when you're developing applications you'll probably want to keep the mode set to “development”.  This will cause Reactor to recreate objects as their structure changes in the database or as their configured relationships change.  Other options are defined in the Reactor.xml Configuration File section.

 

The Objects tag is empty right now because we haven't defined any relationships.

 

Now that we have a configuration file we can get started Creating Objects with Reactor.