Permalink
Browse files

Making Doctrine extend from \lithium\data\Source

  • Loading branch information...
mariano committed May 11, 2012
1 parent 6236722 commit 1ed646fe275cce894da00e888d0c0804d9374a08
Showing with 90 additions and 1 deletion.
  1. +90 −1 extensions/data/source/Doctrine.php
@@ -17,7 +17,7 @@
/**
* This datasource provides integration of Doctrine2 models
*/
-class Doctrine extends \lithium\core\Object {
+class Doctrine extends \lithium\data\Source {
/**
* Connection settings for Doctrine
*
@@ -154,5 +154,94 @@ protected function dispatchEntityEvent($entity, $eventName, array $args) {
call_user_func_array(array($entity, $eventName), $args);
}
}
+
+ /**
+ * @todo
+ */
+ public function connect() {}
+
+ /**
+ * @todo
+ */
+ public function disconnect() {}
+
+ /**
+ * Returns a list of objects (sources) that models can bind to, i.e. a list of tables in the
+ * case of a database, or REST collections, in the case of a web service.
+ *
+ * @param string $class The fully-name-spaced class name of the object making the request.
+ * @return array Returns an array of objects to which models can connect.
+ * @todo
+ */
+ public function sources($class = null) {}
+
+ /**
+ * Gets the column schema for a given entity (such as a database table).
+ *
+ * @param mixed $entity Specifies the table name for which the schema should be returned, or
+ * the class name of the model object requesting the schema, in which case the model
+ * class will be queried for the correct table name.
+ * @param array $meta
+ * @return array Returns an associative array describing the given table's schema, where the
+ * array keys are the available fields, and the values are arrays describing each
+ * field, containing the following keys:
+ * - `'type'`: The field type name
+ * @todo
+ */
+ public function describe($entity, array $meta = array()) {}
+
+ /**
+ * Defines or modifies the default settings of a relationship between two models.
+ *
+ * @param $class the primary model of the relationship
+ * @param $type the type of the relationship (hasMany, hasOne, belongsTo)
+ * @param $name the name of the relationship
+ * @param array $options relationship options
+ * @return array Returns an array containing the configuration for a model relationship.
+ */
+ public function relationship($class, $type, $name, array $options = array()) {}
+
+ /**
+ * Abstract. Must be defined by child classes.
+ *
+ * @param mixed $query
+ * @param array $options
+ * @return boolean Returns true if the operation was a success, otherwise false.
+ * @todo
+ */
+ public function create($query, array $options = array()) {}
+
+ /**
+ * Abstract. Must be defined by child classes.
+ *
+ * @param mixed $query
+ * @param array $options
+ * @return boolean Returns true if the operation was a success, otherwise false.
+ * @todo
+ */
+ public function read($query, array $options = array()) {}
+
+ /**
+ * Updates a set of records in a concrete data store.
+ *
+ * @param mixed $query An object which defines the update operation(s) that should be performed
+ * against the data store. This can be a `Query`, a `RecordSet`, a `Record`, or a
+ * subclass of one of the three. Alternatively, `$query` can be an adapter-specific
+ * query string.
+ * @param array $options Options to execute, which are defined by the concrete implementation.
+ * @return boolean Returns true if the update operation was a success, otherwise false.
+ * @todo
+ */
+ public function update($query, array $options = array()) {}
+
+ /**
+ * Abstract. Must be defined by child classes.
+ *
+ * @param mixed $query
+ * @param array $options
+ * @return boolean Returns true if the operation was a success, otherwise false.
+ * @todo
+ */
+ public function delete($query, array $options = array()) {}
}
?>

0 comments on commit 1ed646f

Please sign in to comment.