浏览代码

Shim actsAs

Mark Scherer 11 年之前
父节点
当前提交
9d0a198ee4
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10 0
      src/Model/Table/Table.php

+ 10 - 0
src/Model/Table/Table.php

@@ -36,6 +36,16 @@ class Table extends CakeTable {
 
 		$this->prefixOrderProperty();
 
+		if (isset($this->actsAs)) {
+			foreach ($this->actsAs as $name => $options) {
+				if (is_numeric($name)) {
+					$name = $options;
+					$options = [];
+				}
+				$this->addBehavior($name, $options);
+			}
+		}
+
 		if ($this->hasField('created') || $this->hasField('modified')) {
 			$this->addBehavior('Timestamp');
 		}