Class Scenario_Data_Adapter_Zend

Description

Data adapter for Zend Framework db objects.

Adapter class used to store and retrieve experiment data from a database, handled via a Zend_Db_Adapter instance. Requires Zend Framework. See http://framework.zend.com/

  • copyright: Copyright (c) 2010 TK Studios. (http://www.tkstudios.com)
  • license: New BSD License

Located in /Scenario/Data/Adapter/Zend.php (line 38)

Scenario_Data_Adapter
   |
   --Scenario_Data_Adapter_Zend
Variable Summary
Zend_Db_Adapter_Abstract $_dbAdapter
array $_tables
Method Summary
Scenario_Data_Adapter_Zend __construct ([ $adapter = null])
Scenario_Experiment AddExperiment (string $name, [array $data = array()])
bool AddTreatment (Scenario_Experiment $exp, string $treatmentname)
void ClearExperiment (string|Scenario_Experiment $experiment, [bool $delete = false])
void ClearTreatment (string|Scenario_Experiment $experiment, string|Scenario_Treatment $treatment, [bool $delete = false])
Zend_Db_Adapter_Abstract getDbAdapter ()
void GetExperimentData (string $name)
int GetExperimentID (string $name)
array GetExperiments ()
Scenario_ResultSet GetResults (mixed $experiment)
Scenario_Treatment|null GetTreatmentByName (Scenario_Experiment $experiment, string $name)
int GetTreatmentID (Scenario_Experiment $exp, string $treatmentname)
void setAdapter ( $adapter)
string __get (string $name)
Variables
Zend_Db_Adapter_Abstract $_dbAdapter (line 45)

Zend db adapter object.

  • access: protected
array $_tables (line 52)

Table definitions, drawn from core option 'db.tables'

  • access: protected

Inherited Variables

Inherited from Scenario_Data_Adapter

Scenario_Data_Adapter::$_core
Methods
Constructor __construct (line 94)

Constructor.

Recommended method for setting the Zend adapter.

  • access: public
Scenario_Data_Adapter_Zend __construct ([ $adapter = null])
  • Zend_Db_Adapter_Abstract $adapter: Zend_Db_Adapter_Abstract to use for data storage.
AddExperiment (line 587)

Create a new Experiment record in the data source, with a unique name and optional serialized data

  • return: The created experiment object.
  • access: public
Scenario_Experiment AddExperiment (string $name, [array $data = array()])
  • string $name: Unique name to assign the experiment.
  • array $data: Optional data to be serialized in the record.

Redefinition of:
Scenario_Data_Adapter::AddExperiment()
Add an experiment
AddTreatment (line 457)

Add a treatment

  • return: Whether the operation was successful
  • access: protected
bool AddTreatment (Scenario_Experiment $exp, string $treatmentname)
ClearExperiment (line 225)

Clears all data for an experiment.

Clears all collected data for an experiment, optionally deleting the actual experiment record.

  • access: public
void ClearExperiment (string|Scenario_Experiment $experiment, [bool $delete = false])
  • string|Scenario_Experiment $experiment: The experiment to clear.
  • bool $delete: Whether or not to delete the record after clearing its data.

Redefinition of:
Scenario_Data_Adapter::ClearExperiment()
Clears all data for an experiment.
ClearTreatment (line 177)

Clears all records for a given treatment/experiment combo.

Deletes all records of the desired experiment/treatment. Useful if you want to keep the data for a few treatments (control, for example).

  • access: public
void ClearTreatment (string|Scenario_Experiment $experiment, string|Scenario_Treatment $treatment, [bool $delete = false])
  • string|Scenario_Experiment $experiment: Experiment that the treatment belongs to.
  • string|Scenario_Treatment $treatment: Treatment you wish to clear.
  • bool $delete: Whether or not to delete the actual treatment record after clearing its data.

Redefinition of:
Scenario_Data_Adapter::ClearTreatment()
Clears all records for a given treatment/experiment combo.
FinishTreatment (line 549)

Modify a treatment/id combo as being a completed goal

  • return: Success
  • access: public
bool FinishTreatment (Scenario_Treatment $treatment, Scenario_Identity $id)

Redefinition of:
Scenario_Data_Adapter::FinishTreatment()
Finish a treatment
getDbAdapter (line 120)

Get the current Zend_Db_Adapter_Abstract object.

Gets the DB adapter to use, creating it from core settings if it doesn't already exist. Requires that the ['db']['uri'] key be set to a parsable url, in the format

  1.  zend_adapter://username:password@hostname/database
Where zend_adapter may be any string accepted by the first parameter in Zend_Db::factory(...)

  • return: Adapter to use for all data storage operations.
  • access: public
Zend_Db_Adapter_Abstract getDbAdapter ()
GetExperimentByName (line 151)

Retrieve an experiment by name.

Fetch an experiment from the data source by its unique name. May be case sensitive.

  • return: The experiment object associated with the provided unique name. Returns null if not found.
  • access: public
Scenario_Experiment GetExperimentByName (string $name)
  • string $name: Unique name of the desired experiment record.

Redefinition of:
Scenario_Data_Adapter::GetExperimentByName()
Get an experiment by its name.
GetExperimentData (line 576)
  • todo:
  • access: public
void GetExperimentData (string $name)
  • string $name

Redefinition of:
Scenario_Data_Adapter::GetExperimentData()
Get extended data for an experiment.
GetExperimentID (line 290)

Gets the ID of an experiment, if it exists in the database.

  • access: public
int GetExperimentID (string $name)
  • string $name
GetExperiments (line 265)

Get all existing experiments.

Retrieves an array of stored Scenario_Experiment objects.

  • return: An array of Scenario_Experiment objects.
  • access: public
array GetExperiments ()

Redefinition of:
Scenario_Data_Adapter::GetExperiments()
Get all existing experiments.
GetResults (line 502)

Getch all results for a given experiment as a Scenario_ResultSet

  • return: Result collection.
  • access: public
Scenario_ResultSet GetResults (mixed $experiment)
  • mixed $experiment: Experiment to fetch results for, accepts string or Scenario_Experiment object.

Redefinition of:
Scenario_Data_Adapter::GetResults()
Fetch all results for a given experiment as a Scenario_ResultSet
GetTreatmentByName (line 342)

Get a specific treatment by name.

Retrieves a specific treatment object, including its primary key (row id).

  • return: Treatment retrieved or null on failure.
  • access: public
Scenario_Treatment|null GetTreatmentByName (Scenario_Experiment $experiment, string $name)
  • Scenario_Experiment $experiment: Experiment to restrict the search to.
  • string $name: Name of the treatment to retrieve.

Redefinition of:
Scenario_Data_Adapter::GetTreatmentByName()
Retrieves a specific treatment object.
GetTreatmentForIdentity (line 309)

Get an existing treatment.

Retrieve the current treatment in use by a Experiment/id combo. Returns null if not yet in use.

  • access: public
Scenario_Treatment|null GetTreatmentForIdentity (Scenario_Experiment $experiment, Scenario_Identity $id)

Redefinition of:
Scenario_Data_Adapter::GetTreatmentForIdentity()
Retrieve the current treatment in use by a test/id combo. Returns null if not yet in use.
GetTreatmentID (line 484)

GetTreatmentID

  • return: primary key (int) of the treatment in question
  • access: protected
int GetTreatmentID (Scenario_Experiment $exp, string $treatmentname)
GetTreatmentsForExperiment (line 369)

Get available treatments for an experiment.

Fetches all possible treatments for a given experiment. They must have already been registered in the database.

  • return: Returns an array of Scenario_Treatment objects.
  • access: public
array GetTreatmentsForExperiment (Scenario_Experiment $experiment)

Redefinition of:
Scenario_Data_Adapter::GetTreatmentsForExperiment()
Fetches all possible treatments for a given experiment.
setAdapter (line 104)

Assigns a new or existing zend db adapter as the db adapter for this instance.

  • access: public
void setAdapter ( $adapter)
  • Zend_Db_Adapter_Abstract $adapter: Zend DB Adapter to assign to this data adapter
SetTreatment (line 396)

Set a Experiment/id combo to a specific treatment

  • access: public
void SetTreatment (Scenario_Experiment $experiment, Scenario_Treatment $value, Scenario_Identity $id)

Redefinition of:
Scenario_Data_Adapter::SetTreatment()
Set a test/id combo to a specific treatment
__get (line 60)

Getter override, used for table lookups.

  • access: public
string __get (string $name)
  • string $name

Inherited Methods

Inherited From Scenario_Data_Adapter

Scenario_Data_Adapter::AddExperiment()
Scenario_Data_Adapter::ClearExperiment()
Scenario_Data_Adapter::ClearTreatment()
Scenario_Data_Adapter::FinishTreatment()
Scenario_Data_Adapter::getCore()
Scenario_Data_Adapter::GetExperiment()
Scenario_Data_Adapter::GetExperimentByName()
Scenario_Data_Adapter::GetExperimentData()
Scenario_Data_Adapter::GetExperiments()
Scenario_Data_Adapter::GetResults()
Scenario_Data_Adapter::GetTreatment()
Scenario_Data_Adapter::GetTreatmentByName()
Scenario_Data_Adapter::GetTreatmentForIdentity()
Scenario_Data_Adapter::GetTreatmentsForExperiment()
Scenario_Data_Adapter::setCore()
Scenario_Data_Adapter::SetTreatment()
Class Constants

Documentation generated on Sat, 23 Oct 2010 18:10:53 -0400 by phpDocumentor 1.4.3