public static function fromNode($node)
    {
        $p = new self();
        $p->setNid($node->id());
        $p->setPhpVersion('7.0');
        if ($node->hasField('field_pull_request_template') && !$node->get('field_pull_request_template')->isEmpty()) {
            $p->setCustomPrMessage($node->get('field_pull_request_template')->first()->getString());
        }
        if (!$p->getCustomPrMessage()) {
            // See if we have a default one on the user.
            $owner = $node->getOwner();
            if ($owner->hasField('field_user_pr_template') && !$owner->get('field_user_pr_template')->isEmpty()) {
                $p->setCustomPrMessage($owner->get('field_user_pr_template')->first()->getString());
            }
        }
        if ($node->hasField('field_php_version') && !$node->get('field_php_version')->isEmpty()) {
            $p->setPhpVersion($node->get('field_php_version')->first()->getString());
        }
        $owner = $node->getOwner();
        if ($owner) {
            $p->setRoles($owner->getRoles());
        }
        return $p;
    }
public static function fromNode($node)
    {
        $p = new self();
        $p->setNid($node->id());
        $p->setPhpVersion('7.0');
        if ($node->hasField('field_pull_request_template') && !$node->get('field_pull_request_template')->isEmpty()) {
            $p->setCustomPrMessage($node->get('field_pull_request_template')->first()->getString());
        }
        if (!$p->getCustomPrMessage()) {
            // See if we have a default one on the user.
            $owner = $node->getOwner();
            if ($owner->hasField('field_user_pr_template') && !$owner->get('field_user_pr_template')->isEmpty()) {
                $p->setCustomPrMessage($owner->get('field_user_pr_template')->first()->getString());
            }
        }
        if ($node->hasField('field_php_version') && !$node->get('field_php_version')->isEmpty()) {
            $p->setPhpVersion($node->get('field_php_version')->first()->getString());
        }
        $owner = $node->getOwner();
        if ($owner) {
            $p->setRoles($owner->getRoles());
        }
        return $p;
    }
public static function fromNode ( $ node ) { $ p = new self ( ) ; $ p -> setNid ( $ node -> id ( ) ) ; $ p -> setPhpVersion ( '7.0' ) ; if ( $ node -> hasField ( 'field_pull_request_template' ) && ! $ node -> get ( 'field_pull_request_template' ) -> isEmpty ( ) ) { $ p -> setCustomPrMessage ( $ node -> get ( 'field_pull_request_template' ) -> first ( ) -> getString ( ) ) ; } if ( ! $ p -> getCustomPrMessage ( ) ) { // See if we have a default one on the user. $ owner = $ node -> getOwner ( ) ; if ( $ owner -> hasField ( 'field_user_pr_template' ) && ! $ owner -> get ( 'field_user_pr_template' ) -> isEmpty ( ) ) { $ p -> setCustomPrMessage ( $ owner -> get ( 'field_user_pr_template' ) -> first ( ) -> getString ( ) ) ; } } if ( $ node -> hasField ( 'field_php_version' ) && ! $ node -> get ( 'field_php_version' ) -> isEmpty ( ) ) { $ p -> setPhpVersion ( $ node -> get ( 'field_php_version' ) -> first ( ) -> getString ( ) ) ; } $ owner = $ node -> getOwner ( ) ; if ( $ owner ) { $ p -> setRoles ( $ owner -> getRoles ( ) ) ; } return $ p ; }
Create an object from a node.

@param \Drupal\node\NodeInterface $node
A node.

@return \Violinist\ProjectData\ProjectData
A new project.
Create an object from a node .