Programming Language PHP

Namespace Oro\Component\Layout\Model

Class LayoutUpdateImport

Method/Function createFromArray

Total Examples 2

2 code examples of PHP Oro\Component\Layout\Model\LayoutUpdateImport::createFromArray extracted from open source projects

Was this example useful?
0
                                                    public function testCreateFromArrayException()
    {
        $this->expectException(\Oro\Component\Layout\Exception\LogicException::class);
        $this->expectExceptionMessage('Import id should be provided, array with "root, namespace" keys given');

        LayoutUpdateImport::createFromArray([
            ImportsAwareLayoutUpdateInterface::ROOT_KEY => 'root_block_id',
            ImportsAwareLayoutUpdateInterface::NAMESPACE_KEY => 'namespace',
        ]);
    }
                                            
Was this example useful?
0
                                                    /**
     * @param string|array $importProperties
     */
    private function createImport($importProperties): LayoutUpdateImport
    {
        if (!is_array($importProperties)) {
            $importProperties = [ImportsAwareLayoutUpdateInterface::ID_KEY => $importProperties];
        }

        return LayoutUpdateImport::createFromArray($importProperties);
    }
                                            
LayoutUpdateImport's Other Methods