Add an instance of the selected class
@requiresRight id WRITE

@return void

@throws SecurityException
@throws \oat\tao\model\metadata\exception\InconsistencyConfigException
@throws common_exception_BadRequest
@throws common_exception_Error
165040
public function addInstance()
    {
        if (!$this->isXmlHttpRequest()) {
            throw new common_exception_BadRequest('wrong request mode');
        }

        $id = $this->getRequestParameter('id');

        $this->validateInstanceRoot($id);

        $this->signatureValidator->checkSignature(
            $this->getRequestParameter('signature'),
            $id
        );

        $response = [];

        $clazz = $this->getClass($id);
        $label = $this->getClassService()->createUniqueLabel($clazz);

        $instance = $this->getClassService()->createInstance($clazz, $label);

        if(!is_null($instance) && $instance instanceof core_kernel_classes_Resource){
            $response = [
                'label' => $instance->getLabel(),
                'uri'   => $instance->getUri()
            ];
        }

        $this->returnJson($response);
    }
563681
public function addInstanceDocument( $instance_file = null, $taxonomy_file = null )
	{
		if ( ! $this->inConstructor )
			throw new Exception( "Reports created using XBRL_Report do not support multiple instances" );

		parent::addInstanceDocument( $instance_file, $taxonomy_file );
	}
769072
public function init()
    {
        parent::init();
        if (is_string($this->cassandra)) {
            $this->cassandra = Yii::$app->get($this->cassandra);
        } elseif (is_array($this->cassandra)) {
            if (!isset($this->cassandra['class'])) {
                $this->cassandra['class'] = Connection::className();
            }
            $this->cassandra = Yii::createObject($this->cassandra);
        }
        if (!$this->cassandra instanceof Connection) {
            throw new InvalidConfigException("Cache::cassandra must be either a Cassandra connection instance or the application component ID of a Cassandra connection.");
        }
    }
239634
public function add() {
		if ($this->request->is('post')) {
			$this->Printer->create();
			if ($this->Printer->save($this->request->data)) {
				$this->Session->setFlash(__('The printer has been saved.'));
				return $this->redirect(array('action' => 'index'));
			} else {
				$this->Session->setFlash(__('The printer could not be saved. Please, try again.'));
			}
		}
		$this->request->data['Printer']['output'] = Configure::read('Printers.output');

		$this->set('drivers', $this->drivers );
		$this->set('driverModels', $this->driver_models);
		$this->set('outputs', $this->outputs);
	}
35754
public function addMethod($name, $overrideOnDefined = false)
    {
        if ($this->methods->offsetExists($name) === true) {
            if ($overrideOnDefined === false) {
                throw Exception\ClassFile::methodAlreadyDefined($this->className, $name);
            }

            $this->methods->offsetUnset($name);
        }

        if (PHPUtils::isReservedAny($name) === true) {
            throw Exception\ClassFile::invalidMethodName($this->className, $name);
        }

        $method = new Element\Method($this, $name);
        $this->methods->offsetSet($name, $method);

        return $method;
    }
833617
public void addInstance(IReferenceableInstance instance) throws AtlasException {

        ClassType classType = typeSystem.getDataType(ClassType.class, instance.getTypeName());
        ITypedReferenceableInstance newInstance = classType.convert(instance, Multiplicity.REQUIRED);
        findReferencedInstancesToPreLoad(newInstance);
        Id id = instance.getId();
        if(mapper.lookupVertex(id) == null) {
            if(id.isAssigned()) {
                guidsToLookup.add(id);
            }
            else {
                addToClassMap(classType, instance);
            }
        }
    }
1194338
public function add()
    {
        $obj = new \CIBlockType();
        if (!$obj->Add($this->getFieldsWithDefault())) {
            throw new \Exception($obj->LAST_ERROR);
        }

        Logger::log("Добавлен тип инфоблока {$this->fields['ID']}", Logger::COLOR_GREEN);
    }
162186
public function addPropertyIndex()
    {
        if(!$this->isXmlHttpRequest()){
            throw new common_exception_BadRequest('wrong request mode');
        }
        if(!$this->hasRequestParameter('uri')){
            throw new Exception("wrong request Parameter");
        }
        $uri = $this->getRequestParameter('uri');

        $clazz = $this->getCurrentClass();

        $index = 1;
        if($this->hasRequestParameter('index')){
            $index = $this->getRequestParameter('index');
        }

        $propertyIndex = 1;
        if($this->hasRequestParameter('propertyIndex')){
            $propertyIndex = $this->getRequestParameter('propertyIndex');
        }

        //create and attach the new index property to the property
        $property = $this->getProperty(tao_helpers_Uri::decode($uri));
        $class = $this->getClass("http://www.tao.lu/Ontologies/TAO.rdf#Index");

        //get property range to select a default tokenizer
        /** @var core_kernel_classes_Class $range */
        $range = $property->getRange();
        //range is empty select item content
        $tokenizer = null;
        if (is_null($range)) {
            $tokenizer = $this->getResource('http://www.tao.lu/Ontologies/TAO.rdf#RawValueTokenizer');
        } else {
            $tokenizer = $range->getUri() === OntologyRdfs::RDFS_LITERAL
                ? $this->getResource('http://www.tao.lu/Ontologies/TAO.rdf#RawValueTokenizer')
                : $this->getResource('http://www.tao.lu/Ontologies/TAO.rdf#LabelTokenizer');
        }

        $indexClass = $this->getClass('http://www.tao.lu/Ontologies/TAO.rdf#Index');
        $i = 0;
        $indexIdentifierBackup = preg_replace('/[^a-z_0-9]/','_',strtolower($property->getLabel()));
        $indexIdentifierBackup = ltrim(trim($indexIdentifierBackup, '_'),'0..9');
        $indexIdentifier = $indexIdentifierBackup;
        do{
            if($i !== 0){
                $indexIdentifier = $indexIdentifierBackup.'_'.$i;
            }
            $resources = $indexClass->searchInstances(array(OntologyIndex::PROPERTY_INDEX_IDENTIFIER => $indexIdentifier), array('like' => false));
            $count = count($resources);
            $i++;
        }while($count !== 0);

        $indexProperty = $class->createInstanceWithProperties(array(
                OntologyRdfs::RDFS_LABEL => preg_replace('/_/',' ',ucfirst($indexIdentifier)),
                OntologyIndex::PROPERTY_INDEX_IDENTIFIER => $indexIdentifier,
                OntologyIndex::PROPERTY_INDEX_TOKENIZER => $tokenizer,
                OntologyIndex::PROPERTY_INDEX_FUZZY_MATCHING => GenerisRdf::GENERIS_TRUE,
                OntologyIndex::PROPERTY_DEFAULT_SEARCH  => GenerisRdf::GENERIS_FALSE,
            ));

        $property->setPropertyValue($this->getProperty(OntologyIndex::PROPERTY_INDEX), $indexProperty);

        //generate form
        $indexFormContainer = new tao_actions_form_IndexProperty(new OntologyIndex($indexProperty), $propertyIndex.$index);
        $myForm = $indexFormContainer->getForm();
        $form = trim(preg_replace('/\s+/', ' ', $myForm->renderElements()));
        $this->returnJson(array('form' => $form));
    }
1069123
public function add()
	{
		// Get the hook we're setting
		$trigger = $this->arguments->getOpt(3);
		$hook    = $this->arguments->getOpt(4);

		// Delete the primary args so they aren't added as top level config values
		$this->arguments->deleteOpt(3);
		$this->arguments->deleteOpt(4);

		// Set the new hooks argument
		$this->arguments->setOpt('hooks', array($trigger => array($hook)));

		// Redirect back to the basic configuration set method
		App::get('client')->call('configuration', 'set', $this->arguments, $this->output);
	}
783874
public function create()
    {
        if (!$this->name) {
            throw new UnexpectedValueException(
                'Cannot create a user with no name'
            );
        }

        $parts = array('CREATE USER :user');
        $params = array(':user' => $this->name);

        if ($this->host) {
            $parts[] = '@:host';
            $params[':host'] = strtolower($this->host) == 'any' ? '%' : $this->host;
        }
        if ($this->password) {
            $parts[] = 'IDENTIFIED BY :password';
            $params[':password'] = $this->password;
        }

        // Wrap in 'FLUSH PRIVILEGES' commands to update in-memory state
        $this->client->execute('FLUSH PRIVILEGES');
        $this->client->execute(implode(' ', $parts), $params);
        $this->client->execute('FLUSH PRIVILEGES');
    }
1244747
public void addException(ClassConstant type, int start, int end, int handler)
  {
    _exceptions.add(new ExceptionItem(type.getIndex(), start, end, handler));
  }
1231903
protected function setupClass() {
		$this->_class->setName($this->getNames()->modelName);
		$this->_class->setExtendedClass('AbstractTableGateway');
		$this->_class->setImplementedInterfaces(['EventManagerAwareInterface']);

		$docBlock = new DocBlockGenerator();
		$docBlock->setShortDescription("DataTable for {$this->getNames()->tableName}");

		$this->_class->setDocBlock($docBlock);

		// isSequence
		$property = new PropertyGenerator('isSequence');
		$property->setVisibility('private');
		$property->setDefaultValue($this->getNames()->primaryIsSequence);
		$property->setDocBlock(DocBlockGenerator::fromArray([
		    'tags' => [[
		        'name' => 'var',
		        'description' => 'boolean is primary key autonumbered']]]));
		$this->_class->addPropertyFromGenerator($property);
		
		// primaryKeyField
		$property = new PropertyGenerator('primaryKeyField');
		$property->setVisibility('private');
		$property->setDefaultValue($this->getNames()->primary);
		$property->setDocBlock(DocBlockGenerator::fromArray([
			'tags' => [[
				'name' => 'var',
				'description' => 'string name of primary key']]]));
		$this->_class->addPropertyFromGenerator($property);

		// columnDefaults
		$columnDefault = [];
		foreach ($this->getNames()->properties as $key => $value) {
			$columnDefault[$key] = $value['default'];
		}
		$property = new PropertyGenerator('columnDefaults');
		$property->setVisibility('protected');
		$property->setDefaultValue($columnDefault);
		$property->setDocBlock(DocBlockGenerator::fromArray([
			'tags' => [[
				'name' => 'var',
				'description' => 'Array default values']]]));
		$this->_class->addPropertyFromGenerator($property);

		// events
		$property = new PropertyGenerator('events');
		$property->setVisibility('protected');
		$property->setDocBlock(DocBlockGenerator::fromArray([
		    'tags' => [[
		        'name' => 'var',
		        'description' => '\Zend\EventManager\Event Event Manager']]]));
		$this->_class->addPropertyFromGenerator($property);

		$property = new PropertyGenerator('eventsEnabled');
		$property->setVisibility('protected');
		$property->setDefaultValue(true);
		$property->setDocBlock(DocBlockGenerator::fromArray([
		    'tags' => [[
		        'name' => 'var',
		        'description' => 'boolean Event Status']]]));
		$this->_class->addPropertyFromGenerator($property);

		$this->_file->setClass($this->_class);
	}
312627
private function add()
    {
        // skip if it's a key
        if ((null !== ($check = $this->tokens->getToken($this->tokens->key() + 1)))
            && ((DocLexer::T_COLON === $check[0])
                || (DocLexer::T_EQUALS === $check[0]))) {
            return;
        }

        $token = $this->tokens->current();
        $value = $this->result->createElement('value');

        if (null !== ($key = $this->key())) {
            $value->setAttribute('key', $key);
        }

        $this->current->appendChild($value);

        $text = null;
        $type = null;

        switch ($token[0]) {
            case DocLexer::T_FALSE:
                $text = '0';
                $type = 'boolean';

                break;
            case DocLexer::T_FLOAT:
                $text = $token[1];
                $type = 'float';

                break;
            case DocLexer::T_IDENTIFIER:
                $text = $token[1];
                $type = 'constant';

                break;
            case DocLexer::T_INTEGER:
                $text = $token[1];
                $type = 'integer';

                break;
            case DocLexer::T_NULL:
                $type = 'null';

                break;
            case DocLexer::T_STRING:
                $text = $token[1];
                $type = 'string';

                break;
            case DocLexer::T_TRUE:
                $text = '1';
                $type = 'boolean';

                break;
        }

        $value->setAttribute('type', $type);

        if (null !== $text) {
            $value->appendChild(new DOMText($text));
        }
    }
757599
public function add() {
        global $CFG, $USER, $DB;

        unset($this->id);
        $this->module       = 'blog';
        $this->userid       = (empty($this->userid)) ? $USER->id : $this->userid;
        $this->lastmodified = time();
        $this->created      = time();

        // Insert the new blog entry.
        $this->id = $DB->insert_record('post', $this);

        if (!empty($CFG->useblogassociations)) {
            $this->add_associations();
        }

        core_tag_tag::set_item_tags('core', 'post', $this->id, context_user::instance($this->userid), $this->tags);

        // Trigger an event for the new entry.
        $event = \core\event\blog_entry_created::create(array(
            'objectid'      => $this->id,
            'relateduserid' => $this->userid
        ));
        $event->set_blog_entry($this);
        $event->trigger();
    }
622992
protected function addConfig()
    {
        try {
            $this->db->createCommand()->batchInsert(
                    PodiumConfig::tableName(),
                    ['name', 'value'],
                    [
                        ['activation_token_expire', PodiumConfig::SECONDS_ACTIVATION_TOKEN_EXPIRE],
                        ['allow_polls', PodiumConfig::FLAG_ALLOW_POLLS],
                        ['email_token_expire', PodiumConfig::SECONDS_EMAIL_TOKEN_EXPIRE],
                        ['from_email', PodiumConfig::DEFAULT_FROM_EMAIL],
                        ['from_name', PodiumConfig::DEFAULT_FROM_NAME],
                        ['hot_minimum', PodiumConfig::HOT_MINIMUM],
                        ['maintenance_mode', PodiumConfig::MAINTENANCE_MODE],
                        ['max_attempts', PodiumConfig::MAX_SEND_ATTEMPTS],
                        ['members_visible', PodiumConfig::FLAG_MEMBERS_VISIBLE],
                        ['merge_posts', PodiumConfig::FLAG_MERGE_POSTS],
                        ['meta_description', PodiumConfig::META_DESCRIPTION],
                        ['meta_keywords', PodiumConfig::META_KEYWORDS],
                        ['name', PodiumConfig::PODIUM_NAME],
                        ['password_reset_token_expire', PodiumConfig::SECONDS_PASSWORD_RESET_TOKEN_EXPIRE],
                        ['recaptcha_secretkey', ''],
                        ['recaptcha_sitekey', ''],
                        ['registration_off', PodiumConfig::REGISTRATION_OFF],
                        ['use_captcha', PodiumConfig::FLAG_USE_CAPTCHA],
                        ['use_wysiwyg', PodiumConfig::FLAG_USE_WYSIWYG],
                        ['version', Podium::getInstance()->version],
                    ]
                )->execute();
            return $this->returnSuccess(Yii::t('podium/flash', 'Default Config settings have been added.'));
        } catch (Exception $e) {
            return $this->returnError($e->getMessage(), __METHOD__,
                Yii::t('podium/flash', 'Error during settings adding')
            );
        }
    }
477601
public function add() {
        $cmsContentMeta = $this->CmsContentMeta->newEntity();
        if ($this->request->is('post')) {
            $cmsContentMeta = $this->CmsContentMeta->patchEntity($cmsContentMeta, $this->request->data);
            if ($this->CmsContentMeta->save($cmsContentMeta)) {
                $this->Flash->success('The cms content meta has been saved.');
                return $this->redirect(['action' => 'index']);
            } else {
                $this->Flash->error('The cms content Meta could not be saved. Please, try again.');
            }
        }
        $cmsContent = $this->CmsContentMeta->CmsContent->find('list', ['limit' => 200]);
        $this->set(compact('cmsContentMeta', 'cmsContent'));
        $this->set('_serialize', ['cmsContentMeta']);
    }
163970
public function addprovider() {
		// Providers are ALWAYS at the root
		$parent = 0;

		$name = (isset($_REQUEST['Name'])) ? basename($_REQUEST['Name']) : _t('ExternalContent.NEWCONNECTOR', "New Connector");

		$type = $_REQUEST['ProviderType'];
		$providerClasses = ClassInfo::subclassesFor(self::$tree_class);

		if (!in_array($type, $providerClasses)) {
			throw new Exception("Invalid connector type");
		}

		$parentObj = null;

		// Create object
		$record = new $type();
		$record->ParentID = $parent;
		$record->Name = $record->Title = $name;

		// if (isset($_REQUEST['returnID'])) {
		// 	return $p->ID;
		// } else {
		// 	return $this->returnItemToUser($p);
		// }

		try {
			$record->write();
		} catch(ValidationException $ex) {
			$form->sessionMessage($ex->getResult()->message(), 'bad');
			return $this->getResponseNegotiator()->respond($this->request);
		}

		singleton('CMSPageEditController')->setCurrentPageID($record->ID);

		Session::set(
			"FormInfo.Form_EditForm.formError.message",
			sprintf(_t('ExternalContent.SourceAdded', 'Successfully created %s'), $type)
		);
		Session::set("FormInfo.Form_EditForm.formError.type", 'good');

		$msg = "New " . FormField::name_to_label($type) . " created";
		$this->response->addHeader('X-Status', rawurlencode(_t('ExternalContent.PROVIDERADDED', $msg)));
		return $this->getResponseNegotiator()->respond($this->request);
	}