public function getId()
	{
		// Check for current asset id and compute other vars
		$current  = $this->model->get('asset_id', null);
		$parentId = $this->getAssetParentId();
		$name     = $this->getAssetName();
		$title    = $this->getAssetTitle();
		$title    = $title ?: $name;

		// Get model for assets
		$asset = Model::oneByName($name);

		// Re-inject the asset id into the model
		$this->model->set('asset_id', $asset->get('id'));

		// Prepare the asset to be stored
		$asset->set('parent_id', $parentId);
		$asset->set('name', $name);
		$asset->set('title', $title);

		if ($this->model->assetRules instanceof \JAccessRules || $this->model->assetRules instanceof \Hubzero\Access\Rules)
		{
			$asset->set('rules', (string)$this->model->assetRules);
		}

		// Specify how a new or moved node asset is inserted into the tree
		if (!$this->model->get('asset_id', null) || $asset->parent_id != $parentId)
		{
			$parent = Model::one($parentId);

			if (!$asset->saveAsLastChildOf($parent))
			{
				return false;
			}
		}
		elseif (!$asset->save())
		{
			return false;
		}

		// Register an event to update the asset name once we know the model id
		if ($this->model->isNew())
		{
			$me = $this;
			\Event::listen(
				function($event) use ($asset, $me)
				{
					$asset->set('name', $me->getAssetName());
					$asset->save();
				},
				$this->model->getTableName() . '_new'
			);
		}

		// Return the id
		return (int)$asset->get('id');
	}
public function getId()
	{
		// Check for current asset id and compute other vars
		$current  = $this->model->get('asset_id', null);
		$parentId = $this->getAssetParentId();
		$name     = $this->getAssetName();
		$title    = $this->getAssetTitle();
		$title    = $title ?: $name;

		// Get model for assets
		$asset = Model::oneByName($name);

		// Re-inject the asset id into the model
		$this->model->set('asset_id', $asset->get('id'));

		// Prepare the asset to be stored
		$asset->set('parent_id', $parentId);
		$asset->set('name', $name);
		$asset->set('title', $title);

		if ($this->model->assetRules instanceof \JAccessRules || $this->model->assetRules instanceof \Hubzero\Access\Rules)
		{
			$asset->set('rules', (string)$this->model->assetRules);
		}

		// Specify how a new or moved node asset is inserted into the tree
		if (!$this->model->get('asset_id', null) || $asset->parent_id != $parentId)
		{
			$parent = Model::one($parentId);

			if (!$asset->saveAsLastChildOf($parent))
			{
				return false;
			}
		}
		elseif (!$asset->save())
		{
			return false;
		}

		// Register an event to update the asset name once we know the model id
		if ($this->model->isNew())
		{
			$me = $this;
			\Event::listen(
				function($event) use ($asset, $me)
				{
					$asset->set('name', $me->getAssetName());
					$asset->save();
				},
				$this->model->getTableName() . '_new'
			);
		}

		// Return the id
		return (int)$asset->get('id');
	}
public function getId ( ) { // Check for current asset id and compute other vars $ current = $ this -> model -> get ( 'asset_id' , null ) ; $ parentId = $ this -> getAssetParentId ( ) ; $ name = $ this -> getAssetName ( ) ; $ title = $ this -> getAssetTitle ( ) ; $ title = $ title ? : $ name ; // Get model for assets $ asset = Model :: oneByName ( $ name ) ; // Re-inject the asset id into the model $ this -> model -> set ( 'asset_id' , $ asset -> get ( 'id' ) ) ; // Prepare the asset to be stored $ asset -> set ( 'parent_id' , $ parentId ) ; $ asset -> set ( 'name' , $ name ) ; $ asset -> set ( 'title' , $ title ) ; if ( $ this -> model -> assetRules instanceof \ JAccessRules || $ this -> model -> assetRules instanceof \ Hubzero \ Access \ Rules ) { $ asset -> set ( 'rules' , ( string ) $ this -> model -> assetRules ) ; } // Specify how a new or moved node asset is inserted into the tree if ( ! $ this -> model -> get ( 'asset_id' , null ) || $ asset -> parent_id != $ parentId ) { $ parent = Model :: one ( $ parentId ) ; if ( ! $ asset -> saveAsLastChildOf ( $ parent ) ) { return false ; } } elseif ( ! $ asset -> save ( ) ) { return false ; } // Register an event to update the asset name once we know the model id if ( $ this -> model -> isNew ( ) ) { $ me = $ this ; \ Event :: listen ( function ( $ event ) use ( $ asset , $ me ) { $ asset -> set ( 'name' , $ me -> getAssetName ( ) ) ; $ asset -> save ( ) ; } , $ this -> model -> getTableName ( ) . '_new' ) ; } // Return the id return ( int ) $ asset -> get ( 'id' ) ; }
Gets the asset id for the object instance

@return  int
@since   2.0.0
Gets the asset id for the object instance