Skip to content

Commit

Permalink
Merge branch '1.3-misc' of github.com:cakephp/cakephp1x into 1.3-misc
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Dec 20, 2009
2 parents cea102c + 55f8668 commit f36e5ef
Show file tree
Hide file tree
Showing 27 changed files with 748 additions and 226 deletions.
1 change: 0 additions & 1 deletion app/config/core.php
Expand Up @@ -29,7 +29,6 @@
* Development Mode:
* 1: Errors and warnings shown, model caches refreshed, flash messages halted.
* 2: As in 1, but also with full debug messages and SQL output.
* 3: As in 2, but also with full controller dump.
*
* In production mode, flash messages redirect after a time interval.
* In development mode, you need to click the flash message to continue.
Expand Down
7 changes: 3 additions & 4 deletions cake/dispatcher.php
Expand Up @@ -420,14 +420,13 @@ function &__getController() {
$this->params = $original;
return $controller;
}
} else {
if (!isset($params['plugin'])) {
$params = $this->_restructureParams($params);
}
}
$name = $ctrlClass;
$ctrlClass .= 'Controller';
if (class_exists($ctrlClass)) {
if (empty($params['plugin']) && strtolower(get_parent_class($ctrlClass)) === strtolower($name . 'AppController')) {
$params = $this->_restructureParams($params);
}
$this->params = $params;
$controller =& new $ctrlClass();
}
Expand Down
2 changes: 1 addition & 1 deletion cake/libs/controller/components/auth.php
Expand Up @@ -253,7 +253,7 @@ class AuthComponent extends Object {
* @return void
* @access public
*/
function initialize(&$controller, $settings) {
function initialize(&$controller, $settings = array()) {
$this->params = $controller->params;
$crud = array('create', 'read', 'update', 'delete');
$this->actionMap = array_merge($this->actionMap, array_combine($crud, $crud));
Expand Down
6 changes: 4 additions & 2 deletions cake/libs/controller/controller.php
Expand Up @@ -1102,9 +1102,11 @@ function paginate($object = null, $scope = array(), $whitelist = array()) {
$value = $options['order'][$key];
unset($options['order'][$key]);

if (isset($object->{$alias}) && $object->{$alias}->hasField($field)) {
if ($object->hasField($field)) {
$options['order'][$alias . '.' . $field] = $value;
} elseif ($object->hasField($field)) {
} elseif ($object->hasField($field, true)) {
$options['order'][$field] = $value;
} elseif (isset($object->{$alias}) && $object->{$alias}->hasField($field)) {
$options['order'][$alias . '.' . $field] = $value;
}
}
Expand Down
71 changes: 52 additions & 19 deletions cake/libs/model/datasources/datasource.php
Expand Up @@ -78,13 +78,15 @@ class DataSource extends Object {
* The starting character that this DataSource uses for quoted identifiers.
*
* @var string
* @access public
*/
var $startQuote = null;

/**
* The ending character that this DataSource uses for quoted identifiers.
*
* @var string
* @access public
*/
var $endQuote = null;

Expand Down Expand Up @@ -199,11 +201,15 @@ class DataSource extends Object {
* should be cached
*
* @var boolean
* @access public
*/
var $cacheSources = true;

/**
* Constructor.
*
* @param array $config Array of configuration information for the datasource.
* @return void.
*/
function __construct($config = array()) {
parent::__construct();
Expand All @@ -213,7 +219,9 @@ function __construct($config = array()) {
/**
* Caches/returns cached results for child instances
*
* @return array
* @param mixed $data
* @return array Array of sources available in this datasource.
* @access public
*/
function listSources($data = null) {
if ($this->cacheSources === false) {
Expand All @@ -240,7 +248,9 @@ function listSources($data = null) {
/**
* Convenience method for DboSource::listSources(). Returns source names in lowercase.
*
* @return array
* @param boolean $reset Whether or not the source list should be reset.
* @return array Array of sources available in this datasource
* @access public
*/
function sources($reset = false) {
if ($reset === true) {
Expand All @@ -253,9 +263,10 @@ function sources($reset = false) {
* Returns a Model description (metadata) or null if none found.
*
* @param Model $model
* @return mixed
* @return array Array of Metadata for the $model
* @access public
*/
function describe($model) {
function describe(&$model) {
if ($this->cacheSources === false) {
return null;
}
Expand All @@ -276,6 +287,7 @@ function describe($model) {
* Begin a transaction
*
* @return boolean Returns true if a transaction is not in progress
* @access public
*/
function begin(&$model) {
return !$this->_transactionStarted;
Expand All @@ -285,6 +297,7 @@ function begin(&$model) {
* Commit a transaction
*
* @return boolean Returns true if a transaction is in progress
* @access public
*/
function commit(&$model) {
return $this->_transactionStarted;
Expand All @@ -294,6 +307,7 @@ function commit(&$model) {
* Rollback a transaction
*
* @return boolean Returns true if a transaction is in progress
* @access public
*/
function rollback(&$model) {
return $this->_transactionStarted;
Expand All @@ -304,6 +318,7 @@ function rollback(&$model) {
*
* @param string $real Real column type (i.e. "varchar(255)")
* @return string Abstract column type (i.e. "string")
* @access public
*/
function column($real) {
return false;
Expand All @@ -318,6 +333,7 @@ function column($real) {
* @param array $fields An Array of fields to be saved.
* @param array $values An Array of values to save.
* @return boolean success
* @access public
*/
function create(&$model, $fields = null, $values = null) {
return false;
Expand All @@ -331,6 +347,7 @@ function create(&$model, $fields = null, $values = null) {
* @param Model $model The model being read.
* @param array $queryData An array of query data used to find the data you want
* @return mixed
* @access public
*/
function read(&$model, $queryData = array()) {
return false;
Expand All @@ -345,6 +362,7 @@ function read(&$model, $queryData = array()) {
* @param array $fields Array of fields to be updated
* @param array $values Array of values to be update $fields to.
* @return boolean Success
* @access public
*/
function update(&$model, $fields = null, $values = null) {
return false;
Expand All @@ -357,6 +375,7 @@ function update(&$model, $fields = null, $values = null) {
*
* @param Model $model The model class having record(s) deleted
* @param mixed $id Primary key of the model
* @access public
*/
function delete(&$model, $id = null) {
if ($id == null) {
Expand All @@ -368,7 +387,8 @@ function delete(&$model, $id = null) {
* Returns the ID generated from the previous INSERT operation.
*
* @param unknown_type $source
* @return in
* @return mixed Last ID key generated in previous INSERT
* @access public
*/
function lastInsertId($source = null) {
return false;
Expand All @@ -378,7 +398,8 @@ function lastInsertId($source = null) {
* Returns the ID generated from the previous INSERT operation.
*
* @param unknown_type $source
* @return in
* @return integer Number of rows returned by last operation
* @access public
*/
function lastNumRows($source = null) {
return false;
Expand All @@ -388,7 +409,8 @@ function lastNumRows($source = null) {
* Returns the ID generated from the previous INSERT operation.
*
* @param unknown_type $source
* @return in
* @return integer Number of rows affected by last query.
* @access public
*/
function lastAffected($source = null) {
return false;
Expand All @@ -400,6 +422,7 @@ function lastAffected($source = null) {
* before establishing a connection.
*
* @return boolean Whether or not the Datasources conditions for use are met.
* @access public
*/
function enabled() {
return true;
Expand All @@ -409,6 +432,7 @@ function enabled() {
*
* @param string $interface The name of the interface (method)
* @return boolean True on success
* @access public
*/
function isInterfaceSupported($interface) {
$methods = get_class_methods(get_class($this));
Expand All @@ -419,10 +443,12 @@ function isInterfaceSupported($interface) {
}

/**
* Sets the configuration for the DataSource
* Sets the configuration for the DataSource.
* Merges the $config information with the _baseConfig and the existing $config property.
*
* @param array $config The configuration array
* @return void
* @access public
*/
function setConfig($config = array()) {
$this->config = array_merge($this->_baseConfig, $this->config, $config);
Expand All @@ -433,6 +459,8 @@ function setConfig($config = array()) {
*
* @param string $object The name of the object (model) to cache
* @param mixed $data The description of the model, usually a string or array
* @return mixed
* @access private
*/
function __cacheDescription($object, $data = null) {
if ($this->cacheSources === false) {
Expand All @@ -455,16 +483,18 @@ function __cacheDescription($object, $data = null) {
}

/**
* Enter description here...
* Replaces `{$__cakeID__$}` and `{$__cakeForeignKey__$}` placeholders in query data.
*
* @param unknown_type $query
* @param unknown_type $data
* @param unknown_type $association
* @param string $query Query string needing replacements done.
* @param array $data Array of data with values that will be inserted in placeholders.
* @param string $association Name of association model being replaced
* @param unknown_type $assocData
* @param Model $model
* @param Model $linkModel
* @param Model $model Instance of the model to replace $__cakeID__$
* @param Model $linkModel Instance of model to replace $__cakeForeignKey__$
* @param array $stack
* @return unknown
* @return string String of query data with placeholders replaced.
* @access public
* @todo Remove and refactor $assocData, ensure uses of the method have the param removed too.
*/
function insertQueryData($query, $data, $association, $assocData, &$model, &$linkModel, $stack) {
$keys = array('{$__cakeID__$}', '{$__cakeForeignKey__$}');
Expand Down Expand Up @@ -538,17 +568,20 @@ function insertQueryData($query, $data, $association, $assocData, &$model, &$lin
/**
* To-be-overridden in subclasses.
*
* @param unknown_type $model
* @param unknown_type $key
* @return unknown
* @param Model $model Model instance
* @param string $key Key name to make
* @return string Key name for model.
* @access public
*/
function resolveKey($model, $key) {
function resolveKey(&$model, $key) {
return $model->alias . $key;
}

/**
* Closes the current datasource.
*
* @return void
* @access public
*/
function __destruct() {
if ($this->_transactionStarted) {
Expand Down

0 comments on commit f36e5ef

Please sign in to comment.