public function addPersistentField(PersistentField $descriptor) { $class = $descriptor->getClass(); if (!array_key_exists($class, $this->persistentFields)) { $this->persistentFields[$class] = array(); } $field = $descriptor->getName(); if (!array_key_exists($field, $this->persistentFields[$class])) { $this->persistentFields[$class][$field] = $descriptor; $descriptor->lock(); } else { throw new Exception("The descriptor ({$class}, {$field}) already exists."); } }