public function importPortableElements()
    {
        if (count($this->importingFiles) != count($this->requiredFiles)) {
            throw new \common_Exception('Needed files are missing during Portable Element asset files '.print_r($this->requiredFiles, true). ' '.print_r($this->importingFiles, true));
        }

        /** @var PortableElementObject $object */
        foreach ($this->portableObjects as $object) {
            $lastVersionModel = $this->getService()->getPortableElementByIdentifier(
                $object->getModel()->getId(),
                $object->getTypeIdentifier()
            );
            //only register a pci that has not been register yet, subsequent update must be done through pci package import
            if (is_null($lastVersionModel)){
                $this->getService()->registerModel(
                    $object,
                    $object->getRegistrationSourcePath($this->source, $this->itemDir)
                );
            } else {
                \common_Logger::i('The imported item contains the portable element '.$object->getTypeIdentifier()
                    .' in a version '.$object->getVersion().' compatible with the current '.$lastVersionModel->getVersion());
            }
        }
        return true;
    }
public function importPortableElements()
    {
        if (count($this->importingFiles) != count($this->requiredFiles)) {
            throw new \common_Exception('Needed files are missing during Portable Element asset files '.print_r($this->requiredFiles, true). ' '.print_r($this->importingFiles, true));
        }

        /** @var PortableElementObject $object */
        foreach ($this->portableObjects as $object) {
            $lastVersionModel = $this->getService()->getPortableElementByIdentifier(
                $object->getModel()->getId(),
                $object->getTypeIdentifier()
            );
            //only register a pci that has not been register yet, subsequent update must be done through pci package import
            if (is_null($lastVersionModel)){
                $this->getService()->registerModel(
                    $object,
                    $object->getRegistrationSourcePath($this->source, $this->itemDir)
                );
            } else {
                \common_Logger::i('The imported item contains the portable element '.$object->getTypeIdentifier()
                    .' in a version '.$object->getVersion().' compatible with the current '.$lastVersionModel->getVersion());
            }
        }
        return true;
    }
public function importPortableElements ( ) { if ( count ( $ this -> importingFiles ) != count ( $ this -> requiredFiles ) ) { throw new \ common_Exception ( 'Needed files are missing during Portable Element asset files ' . print_r ( $ this -> requiredFiles , true ) . ' ' . print_r ( $ this -> importingFiles , true ) ) ; } /** @var PortableElementObject $object */ foreach ( $ this -> portableObjects as $ object ) { $ lastVersionModel = $ this -> getService ( ) -> getPortableElementByIdentifier ( $ object -> getModel ( ) -> getId ( ) , $ object -> getTypeIdentifier ( ) ) ; //only register a pci that has not been register yet, subsequent update must be done through pci package import if ( is_null ( $ lastVersionModel ) ) { $ this -> getService ( ) -> registerModel ( $ object , $ object -> getRegistrationSourcePath ( $ this -> source , $ this -> itemDir ) ) ; } else { \ common_Logger :: i ( 'The imported item contains the portable element ' . $ object -> getTypeIdentifier ( ) . ' in a version ' . $ object -> getVersion ( ) . ' compatible with the current ' . $ lastVersionModel -> getVersion ( ) ) ; } } return true ; }
Do the import of portable elements
Do the import of portable elements