AppserverIo\Appserver\Core\Api\Node\AppNode::initFromApplication PHP Method

initFromApplication() public method

Will initialize an existing app node from a given application
public initFromApplication ( AppserverIo\Psr\Application\ApplicationInterface $application ) : null
$application AppserverIo\Psr\Application\ApplicationInterface The application to init from
return null
    public function initFromApplication(ApplicationInterface $application)
    {
        $this->setNodeName(self::NODE_NAME);
        $this->name = $application->getName();
        $this->webappPath = $application->getWebappPath();
        $this->setUuid($this->newUuid());
    }

Usage Example

コード例 #1
0
ファイル: AppService.php プロジェクト: appserver-io/appserver
 /**
  * Creates a new app node for the passed application and attaches
  * it to the system configuration.
  *
  * @param \AppserverIo\Psr\Application\ApplicationInterface $application The application to create a new AppNode for
  *
  * @return void
  */
 public function newFromApplication(ApplicationInterface $application)
 {
     // create a new AppNode and initialize it
     $appNode = new AppNode();
     $appNode->initFromApplication($application);
     $appNode->setParentUuid($this->getSystemConfiguration()->getUuid());
     // persist the AppNode instance
     $this->persist($appNode);
 }