Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace StagebitTestimonialModelFormData;
- use StagebitTestimonialModelResourceModelTestimonialCollectionFactory;
- use MagentoUiDataProviderAbstractDataProvider;
- class DataProvider extends AbstractDataProvider
- {
- /**
- * @param string $name
- * @param string $primaryFieldName
- * @param string $requestFieldName
- * @param CollectionFactory $testimonialCollectionFactory
- * @param array $meta
- * @param array $data
- */
- public function __construct(
- $name,
- $primaryFieldName,
- $requestFieldName,
- CollectionFactory $testimonialCollectionFactory,
- array $meta = [],
- array $data = []
- ) {
- $this->collection = $testimonialCollectionFactory->create();
- parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);
- }
- /**
- * Get data
- *
- * @return array
- */
- public function getData()
- {
- if (isset($this->_loadedData)) {
- return $this->_loadedData;
- }
- $items = $this->collection->getItems();
- foreach ($items as $testimonial) {
- $this->_loadedData[$testimonial->getTestimonialId()] = $testimonial->getData();
- }
- //return $this->_loadedData;
- }
- }
Add Comment
Please, Sign In to add comment