Browse Source

am to array_merge

euromark 13 years ago
parent
commit
06f1ba229f

+ 1 - 1
Console/Command/CcShell.php

@@ -265,7 +265,7 @@ class CcShell extends AppShell {
 		$files = App::objects($type, null, false);
 		$corePath = App::core($type);
 		$coreFiles = App::objects($type, $corePath, false);
-		$files = am($coreFiles, $files);
+		$files = array_merge($coreFiles, $files);
 		//$paths = (array)App::path($type.'s');
 		//$libFiles = App::objects($type, $paths[0] . 'lib' . DS, false);
 

+ 2 - 2
Console/Command/CodeShell.php

@@ -230,10 +230,10 @@ class CodeShell extends AppShell {
 				$excludes = array('Config');
 				//Iterator processes plugins even if not asked to
 				if (empty($this->params['plugin'])) {
-					$excludes = am($excludes, array('Plugin', 'plugins'));
+					$excludes = array_merge($excludes, array('Plugin', 'plugins'));
 				}
 				if (empty($this->params['vendor'])) {
-					$excludes = am($excludes, array('Vendor', 'vendors'));
+					$excludes = array_merge($excludes, array('Vendor', 'vendors'));
 				}
 				if (!empty($excludes)) {
 					$isIllegalPluginPath = false;

+ 1 - 1
Console/Command/HashShell.php

@@ -24,7 +24,7 @@ class HashShell extends AppShell {
 		$this->out('Hash Strings...');
 		$hashAlgos = hash_algos();
 
-		$types = am(array_keys($hashAlgos), array('q'));
+		$types = array_merge(array_keys($hashAlgos), array('q'));
 		foreach ($hashAlgos as $key => $t) {
 			$this->out(($key+1).': '.$t.(in_array($t, $this->active)?' (!)':''));
 		}

+ 1 - 1
Console/Command/IndexShell.php

@@ -71,7 +71,7 @@ class IndexShell extends AppShell {
 		if (file_exists(APP . 'Config' . DS . 'index.php')) {
 			include(APP . 'Config' . DS . 'index.php');
 			if (!empty($config)) {
-				$this->settings = am($this->settings, $config);
+				$this->settings = array_merge($this->settings, $config);
 			}
 		}
 		*/

+ 1 - 1
Controller/Component/Auth/TinyAuthorize.php

@@ -47,7 +47,7 @@ class TinyAuthorize extends BaseAuthorize {
 	);
 
 	public function __construct(ComponentCollection $Collection, $settings = array()) {
-		$settings = am($this->_defaults, $settings);
+		$settings = array_merge($this->_defaults, $settings);
 		parent::__construct($Collection, $settings);
 
 		if (Cache::config($settings['cache']) === false) {

+ 3 - 1
Controller/Component/AuthExtComponent.php

@@ -175,7 +175,9 @@ class AuthExtComponent extends AuthComponent {
 			$user = array_shift($user);
 		}
 
-		if (isset($Model->hasMany[$this->intermediateModel]['className'])) {
+		if (isset($Model->hasAndBelongsToMany[$this->roleModel]['className'])) {
+			$with = $Model->hasAndBelongsToMany[$this->roleModel]['className'];
+		} elseif (isset($Model->hasMany[$this->intermediateModel]['className'])) {
 			$with = $Model->hasMany[$this->intermediateModel]['className'];
 		} elseif (isset($Model->belongsTo[$this->roleModel]['className'])) {
 			$with = $Model->belongsTo[$this->roleModel]['className'];

+ 1 - 1
Lib/HttpSocketLib.php

@@ -70,7 +70,7 @@ class HttpSocketLib {
 			'use' => $this->use,
 			'timeout' => $this->timeout,
 		);
-		$options = am($defaults, $options);
+		$options = array_merge($defaults, $options);
 
 		# cached?
 		if ($options['cache']) {

+ 1 - 1
Lib/IcalLib.php

@@ -76,7 +76,7 @@ class IcalLib {
 			'prodid' => '-//'.env('HTTP_HOST'),
 			'method' => 'PUBLISH',
 		);
-		$data = am($defaults, $data);
+		$data = array_merge($defaults, $data);
 
 		$res = array();
 		$res[] = 'BEGIN:VCALENDAR';

+ 1 - 1
Lib/SpellLib.php

@@ -46,7 +46,7 @@ class SpellLib {
 			'lang' => 'en_GB',
 			'engine' => self::ENGINE_MYSPELL
 		);
-		$defaults = am($defaults, (array)Configure::read('Spell'));
+		$defaults = array_merge($defaults, (array)Configure::read('Spell'));
 		$options = array_merge($defaults, $options);
 
 		if (!isset($this->_engines[$options['engine']])) {

+ 2 - 2
Lib/Utility/NumberLib.php

@@ -76,7 +76,7 @@ class NumberLib extends CakeNumber {
 			$formatOptions = array();
 		}
 		$options = array('before' => '', 'after' => '', 'places' => 2, 'thousands' => self::$_thousandsPoint, 'decimals' => self::$_decimalPoint, 'escape' => false);
-		$options = am($options, $formatOptions);
+		$options = array_merge($options, $formatOptions);
 		//$options = array;
 
 		if (!empty($options['currency'])) {
@@ -128,7 +128,7 @@ class NumberLib extends CakeNumber {
 			'negative' => '-', 'positive'=> '+', 'escape' => true,
 			'decimals' => self::$_decimalPoint, 'thousands' => self::$_thousandsPoint,
 		);
-		$options = am($options, $formatOptions);
+		$options = array_merge($options, $formatOptions);
 
 		if (!empty($options['wholeSymbol'])) {
 			if ($options['wholePosition'] == 'after') {

+ 4 - 4
Model/Behavior/LinkableBehavior.php

@@ -46,9 +46,9 @@ class LinkableBehavior extends ModelBehavior {
 
 			// If containable is being used, then let it set the recursive!
 			if (empty($query['contain'])) {
-				$query = am(array('joins' => array()), $query, array('recursive' => -1));
+				$query = array_merge(array('joins' => array()), $query, array('recursive' => -1));
 			} else {
-				$query = am(array('joins' => array()), $query);
+				$query = array_merge(array('joins' => array()), $query);
 			}
 			$iterators[] = $query[$this->_key];
 			$cont = 0;
@@ -64,7 +64,7 @@ class LinkableBehavior extends ModelBehavior {
 					if (is_null($options)) {
 						$options = array();
 					}
-					$options = am($defaults, compact('alias'), $options);
+					$options = array_merge($defaults, compact('alias'), $options);
 					if (empty($options['alias'])) {
 						throw new InvalidArgumentException(sprintf('%s::%s must receive aliased links', get_class($this), __FUNCTION__));
 					}
@@ -187,7 +187,7 @@ class LinkableBehavior extends ModelBehavior {
 						}
 					}
 
-					$options[$this->_key] = am($options[$this->_key], array_diff_key($options, $optionsKeys));
+					$options[$this->_key] = array_merge($options[$this->_key], array_diff_key($options, $optionsKeys));
 					$options = array_intersect_key($options, $optionsKeys);
 					if (!empty($options[$this->_key])) {
 						$iterators[] = $options[$this->_key] + array('defaults' => array_merge($defaults, array('reference' => $options['class'])));

+ 6 - 6
Model/Behavior/RevisionBehavior.php

@@ -213,7 +213,7 @@ class RevisionBehavior extends ModelBehavior {
 			return null;
 		}
 		if (isset($options['conditions'])) {
-			$conditions = am($options['conditions'], array($Model->primaryKey => $Model->id));
+			$conditions = array_merge($options['conditions'], array($Model->primaryKey => $Model->id));
 		} else {
 			$conditions = array($Model->primaryKey => $Model->id);
 		}
@@ -349,7 +349,7 @@ class RevisionBehavior extends ModelBehavior {
 			return null;
 		}
 		if (isset($options['conditions'])) {
-			$options['conditions'] = am($options['conditions'], array($Model->alias . '.' . $Model->primaryKey => $Model->id));
+			$options['conditions'] = array_merge($options['conditions'], array($Model->alias . '.' . $Model->primaryKey => $Model->id));
 		} else {
 			$options['conditions'] = array($Model->alias . '.' . $Model->primaryKey => $Model->id);
 		}
@@ -377,7 +377,7 @@ class RevisionBehavior extends ModelBehavior {
 			return null;
 		}
 		if (isset($options['conditions'])) {
-			$options['conditions'] = am($options['conditions'], array($Model->primaryKey => $Model->id));
+			$options['conditions'] = array_merge($options['conditions'], array($Model->primaryKey => $Model->id));
 		} else {
 			$options['conditions'] = array($Model->primaryKey => $Model->id);
 		}
@@ -405,7 +405,7 @@ class RevisionBehavior extends ModelBehavior {
 		$options['limit'] = 1;
 		$options['page'] = 2;
 		if (isset($options['conditions'])) {
-			$options['conditions'] = am($options['conditions'], array($Model->primaryKey => $Model->id));
+			$options['conditions'] = array_merge($options['conditions'], array($Model->primaryKey => $Model->id));
 		} else {
 			$options['conditions'] = array($Model->primaryKey => $Model->id);
 		}
@@ -556,7 +556,7 @@ class RevisionBehavior extends ModelBehavior {
 					'conditions' => array($data['foreignKey'] => $Model->id, 'NOT' => array($Model->primaryKey => $ids)),
 					));
 				if (!empty($revision_children)) {
-					$ids = am($ids, Set::extract($revision_children, '/' . $assoc . '/' . $Model->$assoc->primaryKey));
+					$ids = array_merge($ids, Set::extract($revision_children, '/' . $assoc . '/' . $Model->$assoc->primaryKey));
 				}
 
 				/* Revert all children */
@@ -654,7 +654,7 @@ class RevisionBehavior extends ModelBehavior {
 			return null;
 		}
 		if (isset($options['conditions'])) {
-			$options['conditions'] = am($options['conditions'], array($Model->alias . '.' . $Model->primaryKey => $Model->id));
+			$options['conditions'] = array_merge($options['conditions'], array($Model->alias . '.' . $Model->primaryKey => $Model->id));
 		} else {
 			$options['conditions'] = array($Model->alias . '.' . $Model->primaryKey => $Model->id);
 		}

+ 1 - 1
Model/MyModel.php

@@ -866,7 +866,7 @@ class MyModel extends Model {
 		$defaults = array(
 			'allowEmpty' => false,
 		);
-		$options = am($defaults, $options);
+		$options = array_merge($defaults, $options);
 
 		if ($schema['type'] != 'integer') {
 			if ($options['allowEmpty'] && $value === '') {

+ 1 - 1
Model/Qurl.php

@@ -130,7 +130,7 @@ class Qurl extends ToolsAppModel {
 	 */
 	public function generate($url, $data = array()) {
 		$url = Router::url($url, true);
-		$content = am($data, array('url'=>$url));
+		$content = array_merge($data, array('url'=>$url));
 		if (!isset($content['key'])) {
 			$content['key'] = '';
 		}

+ 3 - 3
View/Helper/FormatHelper.php

@@ -252,7 +252,7 @@ class FormatHelper extends TextHelper {
 			'map' => array(),
 			'css' => true,
 		);
-		$options = am($defaults, $options);
+		$options = array_merge($defaults, $options);
 		extract($options);
 
 		$matching = array(
@@ -285,7 +285,7 @@ class FormatHelper extends TextHelper {
 		if (!$css) {
 			$attr['alt'] = $matching[$value];
 		}
-		$attr = am($attr, array_diff_key($options, $defaults));
+		$attr = array_merge($attr, array_diff_key($options, $defaults));
 
 		if ($css) {
 			$html = $this->Html->tag('div', ' ', $attr);
@@ -1412,7 +1412,7 @@ class FormatHelper extends TextHelper {
 			'heading' => true,
 			'escape' => true
 		);
-		$options = am($defaults, $options);
+		$options = array_merge($defaults, $options);
 
 		// Sanity check
 		if (empty($array) || !is_array($array)) {