I am using yii2 basic.
I have to take survey for village, where in firstly I create villagedata for particular village and then I create family survey for selected villagedata.
I have two tables villagedata and persondata. The relation is one-to-many.
villagedata contains:
-
VillageDataId
-
DistrictId
-
TalukaId
-
VillageId
-
NoOfHouseholds
-
TotalPopulation
-
TotalMale
-
TotalFemale
-
TotalChildren
-
Year
persondata contains:
-
PersonId
-
DistrictId
-
TalukaId
-
VillageId
-
VillageDataId
-
PersonNamwe
-
FamilySize, etc.
I have two CRUD’s for villagedata and persondata
1. For VillageData, actionCreate() is as follows:
The villagedata should not be created if count==1 for selected DistrictId, TalukaId, VillageId and Year.
When count==0, then only village data should be created.
So, actionCreate() works fine
[b]
2.[/b] But for actionUpdate(), the scenario is not working
For eg: There are village data for 2 villages taken in year 2017. One for village Arangaon and other for Walki.
Now in update, if I implement the same condition as in actionCreate(), then update action is not getting worked.
How to accomplish this?