Example #1
0
 /**
  * Property get access.
  * Simply returns a given option.
  * 
  * @param string $propertyName The name of the option to get.
  * @return mixed The option value.
  *
  * @throws ezcBasePropertyNotFoundException
  *         If a the value for the property options is not an instance of
  */
 public function __get($propertyName)
 {
     if (array_key_exists($propertyName, $this->properties)) {
         return $this->properties[$propertyName];
     }
     return parent::__get($propertyName);
 }
Example #2
0
 /**
  * Constructor
  * 
  * @param array|Iterator $data Array or Iterator containing the data
  * @return void
  */
 public function __construct($data)
 {
     $this->createFromArray($data);
     parent::__construct();
 }
Example #3
0
 /**
  * Constructor
  * 
  * Creates a ezcGraphDatabase from a PDOStatement and uses the columns 
  * defined in the definition array as keys and values for the data set. 
  *
  * If the definition array is empty a single column will be used as values,
  * with two columns the first column will be used for the keys and the 
  * second for the data set values.
  *
  * You may define the name of the rows used for keys and values by using 
  * an array like:
  *  array (
  *      ezcGraph::KEY => 'row name',
  *      ezcGraph::VALUE => 'row name',
  *  );
  *
  * PDO by default lowercases all column names, see PDO::setAttribute() for
  * details. If the column names you pass to the dataset definition array
  * are not lowercase, you either need to change the PDO::ATTR_CASE
  * attribute of your PDO connection instance, or lowercase the names passed
  * to the definition array. Otherwise this will throw
  * ezcGraphDatabaseMissingColumnException exceptions.
  *
  * @param PDOStatement $statement
  * @param array $definition
  * @return ezcGraphDatabase
  */
 public function __construct(PDOStatement $statement, array $definition = null)
 {
     parent::__construct();
     $this->data = array();
     $this->createFromPdo($statement, $definition);
 }