I am sending data to the database by checking duplicate data. But I can't be inserting/updating data in the database.

protected function saveEntityFinish(array $entityData, $table) {
        $collection= $this->PostTableFactory->create();
        $item = $collection->getCollection();

        if ($entityData) {
            $tableName = $this->_connection->getTableName($table);
            $entityIn = [];
            $entityInup = [];
            foreach ($entityData as $id => $entityRows) {
                    foreach ($entityRows as $row) {

                        if(count($item->getData()) == 0){
                            $temp= $item->getData();
                            $entityIn[] = $row;
                            $entityInup = $row;

                            $collection = $this->PostTableFactory->create();

                            $entityIn[] = $entityInup;



        return $this;

can I get help on it? Thank you in advance


I have updated my value using CollectionFactory. You can give it a try

 $query = $this->_YourCollection->create()
                ->addFieldToFilter('field_id', $value)
            if ($query->getData()){
                if ($yourCondition){
                    $query->setData('field','valuefor update');
  • Thank you @Ghulam.M for responce, this filter method showing invalid – Praveen Negimani Apr 20 '19 at 5:48

To update a row we have to add that column id attached with updated data in that row will update the row

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.