Use absolute import path for Relationship.php

closes #447
Merge pull request #448 from jpfuentes2/jpfuentes2/use_absolute_require

Use absolute import path for Relationship.php
store reference to sqlite db in static to be accessible in tearDownAfterClass
fixes #462
Merge pull request #463 from koenpunt/fix-db-cleanup

store reference to sqlite db in static to be accessible in tearDownAfterClass
Remove require_once from inside functions
remove all carriage returns <CR>
normalize file endings
Added option for multiple model directories
Added tests
Adding custom support for boolean casting based on connection

The default PHP boolean-to-string casting does not work for some
database connection types (e.g. PostgreSQL).  Added a BOOLEAN
type to the Column class, and then the cast() method delegates
to the a new boolean_to_string() method in the Connection class.

By default the boolean_to_string() method returns the standard
PHP string cast for the boolean, retaining the original behavior.
This method can be overridden in adapter classes to provides custom
casting of boolean values.

Added an overridden boolean_to_string() method into the
adapters/PgsqlAdapter.php class which casts the boolean values
false and true to the strings "0" and "1" respectively.  These
string values are then recognized by the Postgres database as
boolean values, as opposed to the values "" and "1" generated
by the standard PHP cast.
Updated ColumnTest for new BOOLEAN type cast
fixed indentation formatting to match existing code
Updated tests for boolean value casting

Updated the ColumnTest::assert_cast() to test that boolean values are
being casted using the Connection boolean_to_string() method.

Added a PostgreSQL specific test to ensure that boolean values are
being casted as the correct string value.
Updated PgsqlAdapter boolean_to_string() for Postgres boolean values

Modified the boolean_to_string() method in the PgsqlAdapter class to
properly convert values that PHP considers a boolean, as well as
what PostgreSQL considers a boolean value.

E.g., PostgreSQL considers the values 'f', 'false', 'n', 'no', and
'off' as valid values for `false`, but PHP does not.  The original
implementation of this method would return `true` for one of these
values which is incorrect for a PostgreSQL database.

Also modified the base Connection class boolean_to_string() method
to first cast its `$value` parameter as a boolean before casting
it to a string.  This will account for PHP's loose type-casting
and make sure the method returns a consistent casted value.
Shortened the false condition in PgsqlAdapter::boolean_to_string()

While the previous version was explicit and descriptive, it wasn't
that elegant.  This is much nicer.
Added some newlines for readability.
Implemented 'on' option for validations.
Added tests for on create/update/save
Only flag attributes as dirty if the value changes

Attributes should only be flagged as dirty if the assigned attribute
has changed.  Assigning the same value to an attribute as the current
value should not flag the value as dirty.
Added tracking of changed attributes

To complement the flagging of dirty attributes, added functionality
similar to Rails which will track the values of changed attributes.

Added the following methods:
- $model->changed_attributes()
  Returns a hash of all attributes that have changed and their original
  values.
  #=> $changed_attributes[$attribute] = $original_value;

- $model->changes()
  Returns a hash of attributes that have changed with the original and
  current values.
  #=> $changes[$attribute] = array($original_value, $current_value)

- $model->previous_changes()
  Returns the changes to a model's attributes before it was saved.

- $model->attribute_was($attribute)
  Returns the original value of an attribute before it was changed

Also made a change to the read_attribute() method.  It seems that
there is a quirk in PHP when the return value of the __get() method
is passed by reference and you are trying to set a value using one
of the 'combined assignment' operators (e.g. .=).  If the return
value of the __get() method is a reference to an array element then
a weird thing happens - the value passed to the __set() method
is the same as the current value.  That's a super confusing
explanation, so an example will clear it up:

class Person {
    private $attributes = array('name' => "John");
    public function &__get($name) {
        return $this->attributes[$name];
    }
    public function __set($name, $value) {
        echo "original value: {$this->attributes[$name]}\n";
        $this->attributes[$name] = $value;
        echo "new value: {$this->attributes[$name]}\n";
    }
}

$person = new Person();
$person->name .= " Doe";

A simple change to the __get() method:
public function &__get($name) {
    $value = $this->attributes[$name];
    return $value;
}

seems to clear up the issue.  So I applied that same logic to the
Model::read_attribute() method, assigning the $this->attributes[$name]
value to a variable, and then returning that.

I don't think that should mess anything up, all unit tests still pass.