public function validatewithId($form, $attributes = null, $clearErrors = true) { parent::validate($attributes, $clearErrors); foreach ($form->questions_group as $group) { if ($group->id == $this->id) { $this->addError('id', Yii::t('common', 'loginExist')); } } return !$this->hasErrors(); }
/** * This function check indexes and applies them to the collection if needed * see CModel::init() * * @see EMongoEmbeddedDocument::init() * @since v1.1 */ public function init() { parent::init(); if ($this->ensureIndexes && !isset(self::$_indexes[$this->getCollectionName()])) { $indexInfo = $this->getCollection()->getIndexInfo(); array_shift($indexInfo); // strip out default _id index $indexes = array(); foreach ($indexInfo as $index) { $indexes[$index['name']] = array('key' => $index['key'], 'unique' => isset($index['unique']) ? $index['unique'] : false); } self::$_indexes[$this->getCollectionName()] = $indexes; $this->ensureIndexes(); } }
/** * Return the actual list of soft attributes being used by this model * @return array list of initialized soft attributes * @since v1.3.4 */ public function getSoftAttributeNames() { return array_diff(array_keys($this->softAttributes), parent::attributeNames()); }