Add an entry to the global attributes list
@param string $prefix
@param string $name
@param string $parentType (optional default: "xs:anySimpleType")
@return boolean|mixed
324048
public function AddAttribute( $prefix, $name, $parentType = "xs:anySimpleType" )
	{
		$attribute = array();

		$parts = explode( ":", $parentType );
		$parentLocalName = count( $parts ) == 1 ? $parts[0] : $parts[1];
		// BMS 2018-04-09 Fixing the kluge
		$parentPrefix = count( $parts ) == 1 ? SCHEMA_PREFIX : $parts[0];

		$type = $this->getType( $parentLocalName, $parentPrefix );
		if ( ! $type )
		{
			return false;
		}

		$attribute['types'][] = $type;

		$attribute += array(
			'name' => $name,
			'prefix' => $prefix,
			'use' => "optional",
			'class' => 'attribute',
		);

		$this->attributes[ "$prefix:$name"] = $attribute;

		return $this->attributes[ "$prefix:$name"];
	}
340850
public function create(CreateStruct $createStruct, array $parentTag = null)
    {
        $query = $this->handler->createInsertQuery();
        $query
            ->insertInto($this->handler->quoteTable('eztags'))
            ->set(
                $this->handler->quoteColumn('id'),
                $this->handler->getAutoIncrementValue('eztags', 'id')
            )->set(
                $this->handler->quoteColumn('parent_id'),
                $query->bindValue($parentTag !== null ? (int) $parentTag['id'] : 0, null, PDO::PARAM_INT)
            )->set(
                $this->handler->quoteColumn('main_tag_id'),
                $query->bindValue(0, null, PDO::PARAM_INT)
            )->set(
                $this->handler->quoteColumn('modified'),
                $query->bindValue(time(), null, PDO::PARAM_INT)
            )->set(
                $this->handler->quoteColumn('keyword'),
                $query->bindValue($createStruct->keywords[$createStruct->mainLanguageCode], null, PDO::PARAM_STR)
            )->set(
                $this->handler->quoteColumn('depth'),
                $query->bindValue($parentTag !== null ? (int) $parentTag['depth'] + 1 : 1, null, PDO::PARAM_INT)
            )->set(
                $this->handler->quoteColumn('path_string'),
                $query->bindValue('dummy') // Set later
            )->set(
                $this->handler->quoteColumn('remote_id'),
                $query->bindValue($createStruct->remoteId, null, PDO::PARAM_STR)
            )->set(
                $this->handler->quoteColumn('main_language_id'),
                $query->bindValue(
                    $this->languageHandler->loadByLanguageCode(
                        $createStruct->mainLanguageCode
                    )->id,
                    null,
                    PDO::PARAM_INT
                )
            )->set(
                $this->handler->quoteColumn('language_mask'),
                $query->bindValue(
                    $this->generateLanguageMask(
                        $createStruct->keywords,
                        is_bool($createStruct->alwaysAvailable) ? $createStruct->alwaysAvailable : true
                    ),
                    null,
                    PDO::PARAM_INT
                )
            );

        $query->prepare()->execute();

        $tagId = $this->handler->lastInsertId($this->handler->getSequenceName('eztags', 'id'));
        $pathString = ($parentTag !== null ? $parentTag['path_string'] : '/') . $tagId . '/';

        $query = $this->handler->createUpdateQuery();
        $query
            ->update($this->handler->quoteTable('eztags'))
            ->set(
                $this->handler->quoteColumn('path_string'),
                $query->bindValue($pathString, null, PDO::PARAM_STR)
            )->where(
                $query->expr->eq(
                    $this->handler->quoteColumn('id'),
                    $query->bindValue($tagId, null, PDO::PARAM_INT)
                )
            );

        $query->prepare()->execute();

        $this->insertTagKeywords(
            $tagId,
            $createStruct->keywords,
            $createStruct->mainLanguageCode,
            $createStruct->alwaysAvailable
        );

        return $tagId;
    }
943046
public static function queryByParent( $parentId, $parentType ) {

		$tableName = static::tableName();

		return self::queryWithModel()->where( "$tableName.parentId=:pid AND $tableName.parentType=:ptype", [ ':pid' => $parentId, ':ptype' => $parentType ] );
	}
180965
public static function queryByTypeParent( $parentId, $parentType, $type ) {

		$tableName = static::tableName();

		return self::queryWithModel()->where( "$tableName.parentId=:pid AND $tableName.parentType=:ptype AND $tableName.type=:type", [ ':pid' => $parentId, ':ptype' => $parentType, ':type' => $type ] );
	}
1192249
public function hasElement( $name, $prefix = null )
	{
		return isset( $this->elements[ is_null( $prefix ) ? $name : "$prefix:$name" ] );
	}
499786
public function deleteByParent( $parentId, $parentType ) {

		//$modelClass	= static::$modelClass;

		//return $modelClass::deleteByParent( $parentId, $parentType );

		$models	= $this->getByParent( $parentId, $parentType );

		foreach ( $models as $model ) {

			$this->delete( $model );
		}
	}
1338142
public function setupParent($prefix, $prefixMatched, $requestPathOffset, $params) {
		$this->prefix = $prefix;
		$this->parentPrefix = $prefix;
		$this->prefixMatched = $prefixMatched;
		$this->parentPrefixMatched = $prefixMatched;
		$this->requestPathOffset = $requestPathOffset;
		$this->parentRequestPathOffset = $requestPathOffset;
		$this->params = $params;
	}
637798
public static function findByNameTypeLocaleId( $parentId, $parentType, $name, $type, $localeId ) {

		return self::find()->where( 'parentId=:pid AND parentType=:ptype AND name=:name AND type=:type AND localeId=:lid' )
			->addParams( [ ':pid' => $parentId, ':ptype' => $parentType, ':name' => $name, ':type' => $type, ':lid' => $localeId ] )
			->one();
	}
658560
private function resolveExpectedSuffix(string $parentType): string
    {
        if (Strings::endsWith($parentType, 'Interface')) {
            $parentType = Strings::substring($parentType, 0, -strlen('Interface'));
        }

        if (Strings::endsWith($parentType, 'Abstract')) {
            $parentType = Strings::substring($parentType, 0, -strlen('Abstract'));
        }

        if (Strings::startsWith($parentType, 'Abstract')) {
            $parentType = Strings::substring($parentType, strlen('Abstract'));
        }

        return $parentType;
    }
369725
public static function queryByParentType( $parentType, $config = [] ) {

		$type	= isset( $config[ 'type' ] ) ? $config[ 'type' ] : self::TYPE_COMMENT;
		$status	= isset( $config[ 'status' ] ) ? $config[ 'status' ] : self::STATUS_APPROVED;

		return self::find()->where( [ 'parentType' => $parentType, 'type' => $type, 'status' => $status ] );
	}
379621
public static function isExistByNameType( $parentId, $parentType, $name, $type, $config = [] ) {

		$meta = self::queryByNameType( $parentId, $parentType, $name, $type, $config )->one();

		return isset( $meta );
	}
386027
public static function findByName( $parentId, $parentType, $name, $config = [] ) {

		return self::queryByName( $parentId, $parentType, $name, $config )->all();
	}
1352014
public static function isExistByNameTypeLocaleId( $parentId, $parentType, $name, $type, $localeId ) {

		$message = self::findByNameLocaleId( $parentId, $parentType, $name, $type, $localeId );

		return isset( $message );
	}
980177
public static function crud($prefix, $name = null)
    {
        return self::factory($prefix, $name)
            ->endpoint(ApiEndpoint::all())
            ->endpoint(ApiEndpoint::find())
            ->endpoint(ApiEndpoint::create())
            ->endpoint(ApiEndpoint::update())
            ->endpoint(ApiEndpoint::remove());
    }
1147715
public function saveImageAjaxAction($parentId, $parentType)
    {
        $config = FileConfiguration::getImageConfig();
        return $this->saveFileAjaxAction(
            $parentId,
            $parentType,
            $config['objectType'],
            $config['validMimeTypes'],
            $config['extBlackList']
        );
    }
979258
public HsqlName newAutoName(String prefix, HsqlName schema,
                                HsqlName parent, int type) {

        HsqlName name = newAutoName(prefix, (String) null, schema, parent,
                                    type);

        return name;
    }
300532
public function addType(Type $type, $name = '')
    {
        if (!$name) {
            $name = (string)$type;
        }

        $this->types[$name] = $type;
    }