浏览代码

Add virtual field support to slug labels

Jad Bitar 11 年之前
父节点
当前提交
bf6c1cbac1
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/Model/Behavior/SluggedBehavior.php

+ 1 - 1
src/Model/Behavior/SluggedBehavior.php

@@ -128,7 +128,7 @@ class SluggedBehavior extends Behavior {
 						throw new \Exception('(SluggedBehavior::setup) model ' . $this->_table->$alias->name . ' is missing the field ' . $field .
 							' (specified in the setup for model ' . $this->_table->name . ') ');
 					}
-				} elseif (!$this->_table->hasField($field)) {
+				} elseif (!$this->_table->hasField($field) && !method_exists($this->_table->entityClass(), '_get' . Inflector::classify($field))) {
 					throw new \Exception('(SluggedBehavior::setup) model ' . $this->_table->name . ' is missing the field ' . $field . ' specified in the setup.');
 				}
 			}