Creates a database record for the Conversation Editor, then attempts to return the object.

@param string $cnvEditorHandle
@param string $cnvEditorName
@param bool|Package $pkg

@return Editor|null
421835
public static function add($cnvEditorHandle, $cnvEditorName, $pkg = false)
    {
        $pkgID = 0;
        if (is_object($pkg)) {
            $pkgID = $pkg->getPackageID();
        }
        $db = Database::connection();
        $db->insert(
            'ConversationEditors',
            array(
                'cnvEditorHandle' => $cnvEditorHandle,
                'cnvEditorName' => $cnvEditorName,
                'pkgID' => $pkgID,
            )
        );

        return static::getByHandle($cnvEditorHandle);
    }
663674
public function actionAjaxCreateSpec($ccmp_id)
    {
        $model = new PprsPerson;
        $model->$field = $value;
        try {
            if (!$model->save()) {
                return var_export($model->getErrors());
            }
        } catch (Exception $e) {
            throw new CHttpException(500, $e->getMessage());
        }
        
        $ccuc = new CcucUserCompany;
        $ccuc->ccuc_ccmp_id = $ccmp_id;
        $ccuc->ccuc_person_id = $model->pprs_id;
        $ccuc->ccuc_status = CcucUserCompany::CCUC_STATUS_PERSON;
        $ccuc->save();
        
    }
866258
public static int create(DbConn cnx, String textMessage, Integer jobId)
    {
        QueryResult r = cnx.runUpdate("message_insert", jobId, textMessage);

        return r.getGeneratedId();
    }
764214
@Override
    public ConsoleEditor create(String flavor, Terminal terminal) throws EditorInitializationException {
        return create(flavor, terminal, System.in, System.out);
    }
344993
protected function doInteract()
    {
        $this->assistant->writeLine(array("This command helps you to generate a new entity.\n"));

        /*
         * Ask for which bundle we need to create the pagepart
         */
        $this->bundle = $this->askForBundleName('entity');

        /*
         * Ask the database table prefix
         */
        $this->prefix = $this->askForPrefix(null, $this->bundle->getNamespace());

        /*
         * Ask the name of the pagepart
         */
        $this->assistant->writeLine(array(
            '',
            'The name of your Entity: For example: <comment>Address</comment>',
            '',
        ));
        $generator = $this->getGenerator();
        $bundlePath = $this->bundle->getPath();
        $name = $this->assistant->askAndValidate(
            'Entity name',
            function ($name) use ($generator, $bundlePath) {
                // Check reserved words
                if ($generator->isReservedKeyword($name)) {
                    throw new \InvalidArgumentException(sprintf('"%s" is a reserved word', $name));
                }

                if (!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $name)) {
                    throw new \InvalidArgumentException(sprintf('Invalid entity name: %s', $name));
                }

                // Check that entity does not already exist
                if (file_exists($bundlePath.'/Entity/'.$name.'.php')) {
                    throw new \InvalidArgumentException(sprintf('Entity "%s" already exists', $name));
                }

                return $name;
            }
        );
        $this->entityName = $name;

        /*
         * Ask which fields need to be present
         */
        $this->assistant->writeLine(array("\nInstead of starting with a blank entity, you can add some fields now.\n"));
        $fields = $this->askEntityFields($this->bundle);
        $this->fields = array_map(function ($fieldInfo) {
            switch ($fieldInfo['type']) {
                case 'image':
                    return $this->getEntityFields($this->bundle, $this->entityName, $this->prefix, $fieldInfo['name'], $fieldInfo['type'],
                        $fieldInfo['extra'], true, $fieldInfo['minHeight'], $fieldInfo['maxHeight'], $fieldInfo['minWidth'], $fieldInfo['maxWidth'], $fieldInfo['mimeTypes']);

                    break;

                case 'media':
                    return $this->getEntityFields($this->bundle, $this->entityName, $this->prefix, $fieldInfo['name'], $fieldInfo['type'],
                        $fieldInfo['extra'], true, null, null, null, null, $fieldInfo['mimeTypes']);

                    break;

                default:
                    return $this->getEntityFields($this->bundle, $this->entityName, $this->prefix, $fieldInfo['name'], $fieldInfo['type'], $fieldInfo['extra'], true);

                    break;
            }
        }, $fields);

        /*
         * Ask if a repository class needs to be generated
         */
        $this->withRepository = $this->askForWithRepository();
    }
1252496
public function outputConversationEditorAddMessageForm()
    {
        \View::element(DIRNAME_CONVERSATIONS . '/' . DIRNAME_CONVERSATION_EDITOR . '/' .
            $this->cnvEditorHandle . '/message', ['editor' => $this], $this->getPackageHandle());
    }
364056
public function create($name, $parentId, $order = null, $partyId = null)
    {
        $params = [
            'name'     => $name,
            'parentid' => $parentId,
            'order'    => $order,
            'id'       => $partyId,
        ];

        return $this->parseJSON('json', [self::API_CREATE, $params]);
    }
1349947
def createEditor(self, parent, option, index):
        
        logger.debug("ConfigItemDelegate.createEditor, parent: {!r}".format(parent.objectName()))
        assert index.isValid(), "sanity check failed: invalid index"

        cti = index.model().getItem(index)
        editor = cti.createEditor(self, parent, option)
        return editor
720645
public function edit($channelId, $name = null, $position = null, $topic = null)
    {
        $channel = $this->show($channelId);
        $json['name'] = is_null($name) ? $channel['name'] : $name;
        $json['position'] = is_null($position) ? $channel['position'] : $position;
        $json['topic'] = is_null($topic) ? $channel['topic'] : $topic;

        return $this->request('PATCH', 'channels/' . $channelId, [
            'json' => $json
        ]);
    }
668429
public function createRemessa($codigo_banco, $formato = 'cnab400', $layoutVersao = null)
    {
        if (empty($codigo_banco)) {
            throw new \InvalidArgumentException('$codigo_banco cannot be empty');
        }
        switch ($formato) {
            case 'cnab400':
                return new Remessa\Cnab400\Arquivo($codigo_banco, $layoutVersao);
            case 'cnab240':
                return new Remessa\Cnab240\Arquivo($codigo_banco, $layoutVersao);
            default:
                throw new \InvalidArgumentException('Invalid cnab format: ' + $formato);
        }
    }
330135
public static String canonicalClassName(Class<?> c, Package pkg) {
    String name = c.getName();
    if(pkg != null) {
      final String pkgname = pkg.getName();
      if(name.length() > pkgname.length() && name.startsWith(pkgname) && name.charAt(pkgname.length()) == '.') {
        name = name.substring(pkgname.length() + 1);
      }
    }
    if(name.endsWith(ELKIServiceRegistry.FACTORY_POSTFIX)) {
      name = name.substring(0, name.length() - ELKIServiceRegistry.FACTORY_POSTFIX.length());
    }
    return name;
  }
1222413
private function page_edit( $table_name, $row_id = null ){
		$page_edit = new endpoint_form_edit($this->exdb, $this, $table_name, $row_id);
		return $page_edit->execute();
	}
1030631
private function tryProcessRemotePackage(Connection $connection, RemotePackageRepository $repo, RemotePackageImporter $importer, $remotePackageHandle)
    {
        $result = false;
        $this->logger->debug(sprintf('Trying unapproved package with handle %s', $remotePackageHandle));
        $remotePackage = $repo->findOneBy(
            [
                'handle' => $remotePackageHandle,
                'processedOn' => null,
                'approved' => 0,
            ],
            [
                'createdOn' => 'DESC',
            ]
        );
        if ($remotePackage === null) {
            $this->logger->debug(' - FAILED: entity not found (???)');
        } else {
            $error = null;
            try {
                $this->processRemotePackage($connection, $repo, $importer, $remotePackage, false);
            } catch (Exception $x) {
                $error = $x;
            } catch (Throwable $x) {
                $error = $x;
            }
            if ($error !== null) {
                $this->logger->debug(sprintf(' - FAILED: %s', trim($error->getMessage())));
            } else {
                $this->logger->debug(' - SUCCEEDED: marking the package as approved');
                $qb = $repo->createQueryBuilder('rp');
                $qb
                    ->update()
                    ->set('rp.approved', true)
                    ->where($qb->expr()->eq('rp.handle', ':handle'))->setParameter('handle', $remotePackageHandle)
                    ->getQuery()->execute();
                $result = true;
            }
        }

        return $result;
    }
825340
public void openStandAloneFormEditor(final CmsEditorContext context) {

        initEventPreviewHandler();
        final CmsContentDefinition definition;
        try {
            definition = (CmsContentDefinition)CmsRpcPrefetcher.getSerializedObjectFromDictionary(
                getService(),
                I_CmsContentService.DICT_CONTENT_DEFINITION);
        } catch (SerializationException e) {
            RootPanel.get().add(new Label(e.getMessage()));
            return;
        }
        m_isStandAlone = true;
        if (definition.isModelInfo()) {
            openModelSelectDialog(context, definition);
        } else {
            CmsCoreProvider.get().lock(
                CmsContentDefinition.entityIdToUuid(definition.getEntityId()),
                new I_CmsSimpleCallback<Boolean>() {

                    public void execute(Boolean arg) {

                        if (arg.booleanValue()) {

                            registerContentDefinition(definition);
                            // register all external widgets
                            WidgetRegistry.getInstance().registerExternalWidgets(
                                definition.getExternalWidgetConfigurations(),
                                new Command() {

                                    public void execute() {

                                        initEditor(context, definition, null, false, null);
                                    }
                                });

                        } else {
                            showLockedResourceMessage();
                        }
                    }
                });
        }
    }
1247402
public static function getByID($cnvEditorID)
    {
        $db = Database::connection();
        $r = $db->fetchAssoc(
            'select *
             from ConversationEditors
             where cnvEditorID = ?',
            array($cnvEditorID)
        );

        return static::createFromRecord($r);
    }
933264
public static function getList($pkgID = null)
    {
        $db = Database::connection();
        $queryBuilder = $db->createQueryBuilder()
            ->select('e.*')
            ->from('ConversationEditors', 'e')
            ->orderBy('cnvEditorHandle', 'asc');
        if ($pkgID !== null) {
            $queryBuilder->andWhere('e.pkgID = :pkgID')->setParameter('pkgID', $pkgID);
        }

        $cnvEditors = $db->fetchAll($queryBuilder->getSQL(), $queryBuilder->getParameters());
        $editors = array();
        foreach ($cnvEditors as $editorRecord) {
            $cnvEditor = static::createFromRecord($editorRecord);
            $editors[] = $cnvEditor;
        }

        return $editors;
    }
1356412
public function cpcEdit($transactionId, $cpcData)
    {
        $xml = new DOMDocument();
        $hpsTransaction = $xml->createElement('hps:Transaction');
        $hpsPosCreditCPCEdit = $xml->createElement('hps:CreditCPCEdit');
        $hpsPosCreditCPCEdit->appendChild($xml->createElement('hps:GatewayTxnId', $transactionId));
        $hpsPosCreditCPCEdit->appendChild($this->_hydrateCPCData($cpcData, $xml));
        $hpsTransaction->appendChild($hpsPosCreditCPCEdit);

        return $this->_submitTransaction($hpsTransaction, 'CreditCPCEdit');
    }