Magento226: Fatal error Call to a member function setId()
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
2
down vote
favorite
I am getting this error in magento Ui component admin form , it tried changing container instead of form in Ui form , but that did not help either.
Fatal error: Method MagentoUiTemplateEngineXhtmlResult::__toString() must not throw an exception, caught Error: Call to a member function setId() on boolean in /opt/lampp/htdocs/Magentos226/vendor/magento/module-ui/Component/Wrapper/UiComponent.php on line 0
DataSource in Ui Form
<dataSource name="item_form_data_source">
<argument name="dataProvider" xsi:type="configurableObject">
<argument name="class" xsi:type="string">VendorModuleModelItemDataProvider</argument>
<argument name="name" xsi:type="string">igallery_form_data_source</argument>
<argument name="primaryFieldName" xsi:type="string">id</argument>
<argument name="requestFieldName" xsi:type="string">id</argument>
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="submit_url" xsi:type="url" path="module/item/save"/>
</item>
</argument>
</argument>
<argument name="data" xsi:type="array">
<item name="js_config" xsi:type="array">
<item name="component" xsi:type="string">Magento_Ui/js/form/provider</item>
</item>
</argument>
</dataSource>
Media Uploader Code in Ui Form
<htmlContent name="gallery" sortOrder="22">
<argument name="data" xsi:type="array">
<item name="wrapper" xsi:type="array">
<item name="label" xsi:type="string" translate="true"> Images</item>
<item name="collapsible" xsi:type="boolean">true</item>
<item name="opened" xsi:type="boolean">true</item>
</item>
</argument>
<settings>
<wrapper>
<canShow>true</canShow>
<componentType>fieldset</componentType>
</wrapper>
</settings>
<block name="gallery" class="VendorModuleBlockAdminhtmlMediaHelperFormGallery">
<block class="VendorEventsBlockAdminhtmlMediaHelperFormGalleryImage" as="content">
<arguments>
<argument name="config" xsi:type="array">
<item name="parentComponent" xsi:type="string">module_article_form.module_article_form.block_gallery.block_gallery</item>
</argument>
</arguments>
</block>
</block>
</htmlContent>
DataProvider
<?php
namespace VendorModuleModelItem;
use VendorModuleModelResourceModelItemCollectionFactory;
use MagentoFrameworkAppRequestDataPersistorInterface;
class DataProvider extends MagentoUiDataProviderAbstractDataProvider
protected $collection;
protected $dataPersistor;
public $_storeManager;
protected $loadedData;
public function __construct(
$name,
$primaryFieldName,
$requestFieldName,
CollectionFactory $blockCollectionFactory,
DataPersistorInterface $dataPersistor,
MagentoStoreModelStoreManagerInterface $storeManager,
array $meta = ,
array $data =
)
$this->collection = $blockCollectionFactory->create();
$this->_storeManager=$storeManager;
$this->dataPersistor = $dataPersistor;
parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);
public function getData()
if (isset($this->loadedData))
return $this->loadedData;
$items = $this->collection->getItems();
foreach ($items as $page)
$this->loadedData[$page->getId()] = $page->getData();
$data = $this->dataPersistor->get('media-item');
if (!empty($data))
$page = $this->collection->getNewEmptyItem();
$page->setData($data);
$this->loadedData[$page->getId()] = $page->getData();
$this->dataPersistor->clear('media-item');
return $this->loadedData;
magento2 uicomponent image-upload ui-form
add a comment |Â
up vote
2
down vote
favorite
I am getting this error in magento Ui component admin form , it tried changing container instead of form in Ui form , but that did not help either.
Fatal error: Method MagentoUiTemplateEngineXhtmlResult::__toString() must not throw an exception, caught Error: Call to a member function setId() on boolean in /opt/lampp/htdocs/Magentos226/vendor/magento/module-ui/Component/Wrapper/UiComponent.php on line 0
DataSource in Ui Form
<dataSource name="item_form_data_source">
<argument name="dataProvider" xsi:type="configurableObject">
<argument name="class" xsi:type="string">VendorModuleModelItemDataProvider</argument>
<argument name="name" xsi:type="string">igallery_form_data_source</argument>
<argument name="primaryFieldName" xsi:type="string">id</argument>
<argument name="requestFieldName" xsi:type="string">id</argument>
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="submit_url" xsi:type="url" path="module/item/save"/>
</item>
</argument>
</argument>
<argument name="data" xsi:type="array">
<item name="js_config" xsi:type="array">
<item name="component" xsi:type="string">Magento_Ui/js/form/provider</item>
</item>
</argument>
</dataSource>
Media Uploader Code in Ui Form
<htmlContent name="gallery" sortOrder="22">
<argument name="data" xsi:type="array">
<item name="wrapper" xsi:type="array">
<item name="label" xsi:type="string" translate="true"> Images</item>
<item name="collapsible" xsi:type="boolean">true</item>
<item name="opened" xsi:type="boolean">true</item>
</item>
</argument>
<settings>
<wrapper>
<canShow>true</canShow>
<componentType>fieldset</componentType>
</wrapper>
</settings>
<block name="gallery" class="VendorModuleBlockAdminhtmlMediaHelperFormGallery">
<block class="VendorEventsBlockAdminhtmlMediaHelperFormGalleryImage" as="content">
<arguments>
<argument name="config" xsi:type="array">
<item name="parentComponent" xsi:type="string">module_article_form.module_article_form.block_gallery.block_gallery</item>
</argument>
</arguments>
</block>
</block>
</htmlContent>
DataProvider
<?php
namespace VendorModuleModelItem;
use VendorModuleModelResourceModelItemCollectionFactory;
use MagentoFrameworkAppRequestDataPersistorInterface;
class DataProvider extends MagentoUiDataProviderAbstractDataProvider
protected $collection;
protected $dataPersistor;
public $_storeManager;
protected $loadedData;
public function __construct(
$name,
$primaryFieldName,
$requestFieldName,
CollectionFactory $blockCollectionFactory,
DataPersistorInterface $dataPersistor,
MagentoStoreModelStoreManagerInterface $storeManager,
array $meta = ,
array $data =
)
$this->collection = $blockCollectionFactory->create();
$this->_storeManager=$storeManager;
$this->dataPersistor = $dataPersistor;
parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);
public function getData()
if (isset($this->loadedData))
return $this->loadedData;
$items = $this->collection->getItems();
foreach ($items as $page)
$this->loadedData[$page->getId()] = $page->getData();
$data = $this->dataPersistor->get('media-item');
if (!empty($data))
$page = $this->collection->getNewEmptyItem();
$page->setData($data);
$this->loadedData[$page->getId()] = $page->getData();
$this->dataPersistor->clear('media-item');
return $this->loadedData;
magento2 uicomponent image-upload ui-form
2
share your code
– Ranjit Shinde
3 hours ago
Ranjit Shinde relevant code is added please check
– Verdu
1 hour ago
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I am getting this error in magento Ui component admin form , it tried changing container instead of form in Ui form , but that did not help either.
Fatal error: Method MagentoUiTemplateEngineXhtmlResult::__toString() must not throw an exception, caught Error: Call to a member function setId() on boolean in /opt/lampp/htdocs/Magentos226/vendor/magento/module-ui/Component/Wrapper/UiComponent.php on line 0
DataSource in Ui Form
<dataSource name="item_form_data_source">
<argument name="dataProvider" xsi:type="configurableObject">
<argument name="class" xsi:type="string">VendorModuleModelItemDataProvider</argument>
<argument name="name" xsi:type="string">igallery_form_data_source</argument>
<argument name="primaryFieldName" xsi:type="string">id</argument>
<argument name="requestFieldName" xsi:type="string">id</argument>
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="submit_url" xsi:type="url" path="module/item/save"/>
</item>
</argument>
</argument>
<argument name="data" xsi:type="array">
<item name="js_config" xsi:type="array">
<item name="component" xsi:type="string">Magento_Ui/js/form/provider</item>
</item>
</argument>
</dataSource>
Media Uploader Code in Ui Form
<htmlContent name="gallery" sortOrder="22">
<argument name="data" xsi:type="array">
<item name="wrapper" xsi:type="array">
<item name="label" xsi:type="string" translate="true"> Images</item>
<item name="collapsible" xsi:type="boolean">true</item>
<item name="opened" xsi:type="boolean">true</item>
</item>
</argument>
<settings>
<wrapper>
<canShow>true</canShow>
<componentType>fieldset</componentType>
</wrapper>
</settings>
<block name="gallery" class="VendorModuleBlockAdminhtmlMediaHelperFormGallery">
<block class="VendorEventsBlockAdminhtmlMediaHelperFormGalleryImage" as="content">
<arguments>
<argument name="config" xsi:type="array">
<item name="parentComponent" xsi:type="string">module_article_form.module_article_form.block_gallery.block_gallery</item>
</argument>
</arguments>
</block>
</block>
</htmlContent>
DataProvider
<?php
namespace VendorModuleModelItem;
use VendorModuleModelResourceModelItemCollectionFactory;
use MagentoFrameworkAppRequestDataPersistorInterface;
class DataProvider extends MagentoUiDataProviderAbstractDataProvider
protected $collection;
protected $dataPersistor;
public $_storeManager;
protected $loadedData;
public function __construct(
$name,
$primaryFieldName,
$requestFieldName,
CollectionFactory $blockCollectionFactory,
DataPersistorInterface $dataPersistor,
MagentoStoreModelStoreManagerInterface $storeManager,
array $meta = ,
array $data =
)
$this->collection = $blockCollectionFactory->create();
$this->_storeManager=$storeManager;
$this->dataPersistor = $dataPersistor;
parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);
public function getData()
if (isset($this->loadedData))
return $this->loadedData;
$items = $this->collection->getItems();
foreach ($items as $page)
$this->loadedData[$page->getId()] = $page->getData();
$data = $this->dataPersistor->get('media-item');
if (!empty($data))
$page = $this->collection->getNewEmptyItem();
$page->setData($data);
$this->loadedData[$page->getId()] = $page->getData();
$this->dataPersistor->clear('media-item');
return $this->loadedData;
magento2 uicomponent image-upload ui-form
I am getting this error in magento Ui component admin form , it tried changing container instead of form in Ui form , but that did not help either.
Fatal error: Method MagentoUiTemplateEngineXhtmlResult::__toString() must not throw an exception, caught Error: Call to a member function setId() on boolean in /opt/lampp/htdocs/Magentos226/vendor/magento/module-ui/Component/Wrapper/UiComponent.php on line 0
DataSource in Ui Form
<dataSource name="item_form_data_source">
<argument name="dataProvider" xsi:type="configurableObject">
<argument name="class" xsi:type="string">VendorModuleModelItemDataProvider</argument>
<argument name="name" xsi:type="string">igallery_form_data_source</argument>
<argument name="primaryFieldName" xsi:type="string">id</argument>
<argument name="requestFieldName" xsi:type="string">id</argument>
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="submit_url" xsi:type="url" path="module/item/save"/>
</item>
</argument>
</argument>
<argument name="data" xsi:type="array">
<item name="js_config" xsi:type="array">
<item name="component" xsi:type="string">Magento_Ui/js/form/provider</item>
</item>
</argument>
</dataSource>
Media Uploader Code in Ui Form
<htmlContent name="gallery" sortOrder="22">
<argument name="data" xsi:type="array">
<item name="wrapper" xsi:type="array">
<item name="label" xsi:type="string" translate="true"> Images</item>
<item name="collapsible" xsi:type="boolean">true</item>
<item name="opened" xsi:type="boolean">true</item>
</item>
</argument>
<settings>
<wrapper>
<canShow>true</canShow>
<componentType>fieldset</componentType>
</wrapper>
</settings>
<block name="gallery" class="VendorModuleBlockAdminhtmlMediaHelperFormGallery">
<block class="VendorEventsBlockAdminhtmlMediaHelperFormGalleryImage" as="content">
<arguments>
<argument name="config" xsi:type="array">
<item name="parentComponent" xsi:type="string">module_article_form.module_article_form.block_gallery.block_gallery</item>
</argument>
</arguments>
</block>
</block>
</htmlContent>
DataProvider
<?php
namespace VendorModuleModelItem;
use VendorModuleModelResourceModelItemCollectionFactory;
use MagentoFrameworkAppRequestDataPersistorInterface;
class DataProvider extends MagentoUiDataProviderAbstractDataProvider
protected $collection;
protected $dataPersistor;
public $_storeManager;
protected $loadedData;
public function __construct(
$name,
$primaryFieldName,
$requestFieldName,
CollectionFactory $blockCollectionFactory,
DataPersistorInterface $dataPersistor,
MagentoStoreModelStoreManagerInterface $storeManager,
array $meta = ,
array $data =
)
$this->collection = $blockCollectionFactory->create();
$this->_storeManager=$storeManager;
$this->dataPersistor = $dataPersistor;
parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);
public function getData()
if (isset($this->loadedData))
return $this->loadedData;
$items = $this->collection->getItems();
foreach ($items as $page)
$this->loadedData[$page->getId()] = $page->getData();
$data = $this->dataPersistor->get('media-item');
if (!empty($data))
$page = $this->collection->getNewEmptyItem();
$page->setData($data);
$this->loadedData[$page->getId()] = $page->getData();
$this->dataPersistor->clear('media-item');
return $this->loadedData;
magento2 uicomponent image-upload ui-form
magento2 uicomponent image-upload ui-form
edited 1 hour ago
asked 4 hours ago


Verdu
979422
979422
2
share your code
– Ranjit Shinde
3 hours ago
Ranjit Shinde relevant code is added please check
– Verdu
1 hour ago
add a comment |Â
2
share your code
– Ranjit Shinde
3 hours ago
Ranjit Shinde relevant code is added please check
– Verdu
1 hour ago
2
2
share your code
– Ranjit Shinde
3 hours ago
share your code
– Ranjit Shinde
3 hours ago
Ranjit Shinde relevant code is added please check
– Verdu
1 hour ago
Ranjit Shinde relevant code is added please check
– Verdu
1 hour ago
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
Check for typo in code make sure your block path is correct VendorModuleNameBlockAdminhtmlMediaHelperFormGalleryImage
i check this code it is working for me.
<htmlContent name="gallery" sortOrder="22">
<argument name="data" xsi:type="array">
<item name="wrapper" xsi:type="array">
<item name="label" xsi:type="string" translate="true"> Images</item>
<item name="collapsible" xsi:type="boolean">true</item>
<item name="opened" xsi:type="boolean">true</item>
</item>
</argument>
<settings>
<wrapper>
<canShow>true</canShow>
<componentType>fieldset</componentType>
</wrapper>
</settings>
<block name="gallery" class="VendorModuleBlockAdminhtmlMediaHelperFormGallery">
<block class="VendorEventsBlockAdminhtmlMediaHelperFormGalleryImage" as="content">
<arguments>
<argument name="config" xsi:type="array">
<item name="parentComponent" xsi:type="string">module_article_form.module_article_form.block_gallery.block_gallery</item>
</argument>
</arguments>
</block>
</block>
</htmlContent>
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
Check for typo in code make sure your block path is correct VendorModuleNameBlockAdminhtmlMediaHelperFormGalleryImage
i check this code it is working for me.
<htmlContent name="gallery" sortOrder="22">
<argument name="data" xsi:type="array">
<item name="wrapper" xsi:type="array">
<item name="label" xsi:type="string" translate="true"> Images</item>
<item name="collapsible" xsi:type="boolean">true</item>
<item name="opened" xsi:type="boolean">true</item>
</item>
</argument>
<settings>
<wrapper>
<canShow>true</canShow>
<componentType>fieldset</componentType>
</wrapper>
</settings>
<block name="gallery" class="VendorModuleBlockAdminhtmlMediaHelperFormGallery">
<block class="VendorEventsBlockAdminhtmlMediaHelperFormGalleryImage" as="content">
<arguments>
<argument name="config" xsi:type="array">
<item name="parentComponent" xsi:type="string">module_article_form.module_article_form.block_gallery.block_gallery</item>
</argument>
</arguments>
</block>
</block>
</htmlContent>
add a comment |Â
up vote
2
down vote
accepted
Check for typo in code make sure your block path is correct VendorModuleNameBlockAdminhtmlMediaHelperFormGalleryImage
i check this code it is working for me.
<htmlContent name="gallery" sortOrder="22">
<argument name="data" xsi:type="array">
<item name="wrapper" xsi:type="array">
<item name="label" xsi:type="string" translate="true"> Images</item>
<item name="collapsible" xsi:type="boolean">true</item>
<item name="opened" xsi:type="boolean">true</item>
</item>
</argument>
<settings>
<wrapper>
<canShow>true</canShow>
<componentType>fieldset</componentType>
</wrapper>
</settings>
<block name="gallery" class="VendorModuleBlockAdminhtmlMediaHelperFormGallery">
<block class="VendorEventsBlockAdminhtmlMediaHelperFormGalleryImage" as="content">
<arguments>
<argument name="config" xsi:type="array">
<item name="parentComponent" xsi:type="string">module_article_form.module_article_form.block_gallery.block_gallery</item>
</argument>
</arguments>
</block>
</block>
</htmlContent>
add a comment |Â
up vote
2
down vote
accepted
up vote
2
down vote
accepted
Check for typo in code make sure your block path is correct VendorModuleNameBlockAdminhtmlMediaHelperFormGalleryImage
i check this code it is working for me.
<htmlContent name="gallery" sortOrder="22">
<argument name="data" xsi:type="array">
<item name="wrapper" xsi:type="array">
<item name="label" xsi:type="string" translate="true"> Images</item>
<item name="collapsible" xsi:type="boolean">true</item>
<item name="opened" xsi:type="boolean">true</item>
</item>
</argument>
<settings>
<wrapper>
<canShow>true</canShow>
<componentType>fieldset</componentType>
</wrapper>
</settings>
<block name="gallery" class="VendorModuleBlockAdminhtmlMediaHelperFormGallery">
<block class="VendorEventsBlockAdminhtmlMediaHelperFormGalleryImage" as="content">
<arguments>
<argument name="config" xsi:type="array">
<item name="parentComponent" xsi:type="string">module_article_form.module_article_form.block_gallery.block_gallery</item>
</argument>
</arguments>
</block>
</block>
</htmlContent>
Check for typo in code make sure your block path is correct VendorModuleNameBlockAdminhtmlMediaHelperFormGalleryImage
i check this code it is working for me.
<htmlContent name="gallery" sortOrder="22">
<argument name="data" xsi:type="array">
<item name="wrapper" xsi:type="array">
<item name="label" xsi:type="string" translate="true"> Images</item>
<item name="collapsible" xsi:type="boolean">true</item>
<item name="opened" xsi:type="boolean">true</item>
</item>
</argument>
<settings>
<wrapper>
<canShow>true</canShow>
<componentType>fieldset</componentType>
</wrapper>
</settings>
<block name="gallery" class="VendorModuleBlockAdminhtmlMediaHelperFormGallery">
<block class="VendorEventsBlockAdminhtmlMediaHelperFormGalleryImage" as="content">
<arguments>
<argument name="config" xsi:type="array">
<item name="parentComponent" xsi:type="string">module_article_form.module_article_form.block_gallery.block_gallery</item>
</argument>
</arguments>
</block>
</block>
</htmlContent>
answered 14 mins ago


Addify
5495
5495
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f246435%2fmagento226-fatal-error-call-to-a-member-function-setid%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
2
share your code
– Ranjit Shinde
3 hours ago
Ranjit Shinde relevant code is added please check
– Verdu
1 hour ago