/** * @param int $count * * @return array */ public static function createSampleAccountBank($count = 10) { $sample = static::getSample()->getFake(); $listBanksId = Bank::getIdsOrCreateBanks(true); $listtypeId = Bankaccounttype::getDefaultBankTypeIdsOrCreate(true); $buyerIds = Buyers::getRecordIdsOrCreate(30); $supplierIds = Suppliers::getRecordIdsOrCreate(); $ids = array(); for ($rec = 0; $rec < $count; $rec++) { $bankId = $sample->randomElement($listBanksId); $TypeId = $sample->randomElement($listtypeId); $buyerId = $sample->randomElement($buyerIds); $supplierId = $sample->randomElement($supplierIds); $parents = static::getSample()->getBank()->getListOwners($supplierId, $buyerId); $parentId = $parents['id']; $parentType = $parents['type']; $records = static::create(static::getSample()->getBank()->createAccountBank($bankId, $parentId, $parentType, $TypeId)); $ids[] = $records->id; } return $ids; // $bankId,$parentId, $parentType, $typeId }
/** * Generate Data Massive Contact Person * * @param bool $resultIds * * @param int $count * * @return array|string */ public static function generateMassive($resultIds = false, $count = 100) { $posIds = Positions::getIdsPositionOrCreateMassiveDummy(); $deptIds = Dept::getIdsOrCreateMassiveDummy(); $supplierIds = Suppliers::getRecordIdsOrCreate(200); $buyerIds = Buyers::getRecordIdsOrCreate(200); $records = static::getFake()->getContacts()->generateContacts($count, $posIds, $deptIds, $supplierIds, $buyerIds); $contacts = array(); foreach ($records as $record) { $newrecord = static::create($record); $contacts[] = $newrecord->id; } return $resultIds ? $contacts : 'Generate Contact Person with ' . count($contacts) . ' records'; }
public static function generateMassivePhoneSample($resultIds = false, $count = 10) { $listBuyerIds = Buyers::getRecordIdsOrCreate(); $listSupplierIds = Suppliers::getRecordIdsOrCreate(); $ids = array(); for ($r = 0; $r < $count; $r++) { $buyerId = static::pickOneFromArray($listBuyerIds); $supplierId = static::pickOneFromArray($listSupplierIds); $parents = static::getParentRecord($buyerId, $supplierId); $parent = $parents[rand(0, 1)]; $parentId = $parent['id']; $parentType = $parent['type']; $newrecord = static::createRecord(static::getRecordValue($parentId, $parentType)); $ids[] = $newrecord->id; } $total = count($ids); return $resultIds ? $ids : "Generate Phone with {$total} record "; }