Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Google Pixel 9 Pro
vgp
Updated:
Yesterday at 5:57 PM
Ad icon
Jobreceive.com for sale
Blogerwiki
Updated:
Tuesday at 8:55 PM
Post Your Vehicle for Sale — FREE! - https://libro.lk
Kalu_Puth
Updated:
Tuesday at 7:38 PM
ඔයාගෙ Assignment හෝ Thesis එක හරියට හදාගමු
ErMurazor
Updated:
Saturday at 10:52 PM
Ad icon
BlackWall V2ray servers
hu KANNA
Updated:
Sep 23, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Talk!
Coders please advice me
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="BLACKLIST_MEMBER" data-source="post: 24253921" data-attributes="member: 79414"><p><span style="font-size: 12px">මේ දාල තියෙන්නේ dummy code එකක් කියල ලියල තියනවනේ.</span></p><p><span style="font-size: 12px">TNHM මෙම්බෙර් ගේ කෝඩ් එක ප්රශ්නයක් නැහැ return දාල තියෙන්නේ. return use කරනවා redirect කරද්දී. ඔතන redirect නෙමෙයි මොකක් හරි වෙන දෙයක් වෙන්න පුළුවන්. redirect වෙනකොට කෝඩ් එක redirect මෙතඩ් එකේ kill එකක් තියෙනවා. </span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px">setup and go විදිහට ලියපු කෝඩ් වල පහල කොටස රන් වෙන්නේ. ඒ කියන්නේ මුලින් අවශ්ය දේවල් ටික හදාගෙන (redirect කරන්නේ කොහෙටද, error එකක් විදිහටද, ඉන්ෆෝමේෂන් පෙන්නන්න ඕන ඒවා redirect වෙනකොට වගේ දේවල්), පස්සේ තමයි කෝඩ් එක එක්සිකියුට් කරවන්නේ. event dispatcher වගේ එකකින්, ඒ කියන්නේ වෙනම තැනකින්.</span></p><p><span style="font-size: 12px">ඉතිං ඒක එහෙම කියන්න බැහැ, if එකක බ්ලොක් එකේ අගට die එකක් අනිවා එන්න ඕන කියල නීතියක් විදිහට කියන්න කොහෙවත් බැහැ ඒක ලියන එකා දැනගන්න ඕන ඌ ට අවශ්ය විදිහට රන් කරවන්න. </span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px">ඕක ඩමියක්, වෙන ඕනෑම දෙයක් වෙන්න පුළුවන් ඔතන, kill නොවී උනත්.</span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px">උදාහරණයක් විදිහට,</span></p><p><span style="font-size: 12px">[CODE]</span></p><p><span style="font-size: 12px">GuestCounter = $this->getGuestsCount();</span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px">if (!$visitor->isMember()) {</span></p><p> <span style="font-size: 12px">GuestCounter++</span></p><p> <span style="font-size: 12px">$db->commit();</span></p><p><span style="font-size: 12px">}</span></p><p><span style="font-size: 12px">$db->commit();[/CODE]ඔතන die එකක් ඕනේ නැහැ.</span></p><p><span style="font-size: 12px">නමුත් db එකට commit වෙනවා. ඒ කෝඩ් එකත් රන් වෙනවා. රන් උනාට දෙවැනි පාර commit වෙන්නේ නැහැ කලින් කරලා නිසා.</span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px">නැත්තන් මේ වගේ කෝඩ් එකක් ගත්තොත් </span></p><p><span style="font-size: 12px">[CODE]</span></p><p><span style="font-size: 12px">function1{</span></p><p><span style="font-size: 12px">GuestCounter = $this->getGuestsCount();</span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px">if (!$visitor->isMember()) {</span></p><p> <span style="font-size: 12px">GuestCounter++</span></p><p> <span style="font-size: 12px">return $visitor;</span></p><p><span style="font-size: 12px">}</span></p><p><span style="font-size: 12px">$db->commit();</span></p><p><span style="font-size: 12px">}</span></p><p><span style="font-size: 12px">ආපහු වෙන මෙතඩ් එකකදී</span></p><p><span style="font-size: 12px">$membersRepository->setVisitors($guestCounter);</span></p><p><span style="font-size: 12px">$member->save();</span></p><p><span style="font-size: 12px">[/SIZE]</span></p><p><span style="font-size: 12px">[SIZE=3][/CODE] කියල call කරන්න පුළුවන්.save කරනකොට.</span></p><p><span style="font-size: 12px">ඉතින් එක ලියන විදිහ අනුව වෙනස් වෙනවා.</span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px">මූ අහල තියෙන්නේ පල්ලෙහා කොටස රන් වෙන්නේ නැහැ කියල කෙලින්ම අපිට කියල. එතකොට කොහොමත් පලවෙනි මෙතඩ් එක තමයි සරල සහ efficient.</span></p></blockquote><p></p>
[QUOTE="BLACKLIST_MEMBER, post: 24253921, member: 79414"] [SIZE=3]මේ දාල තියෙන්නේ dummy code එකක් කියල ලියල තියනවනේ. TNHM මෙම්බෙර් ගේ කෝඩ් එක ප්රශ්නයක් නැහැ return දාල තියෙන්නේ. return use කරනවා redirect කරද්දී. ඔතන redirect නෙමෙයි මොකක් හරි වෙන දෙයක් වෙන්න පුළුවන්. redirect වෙනකොට කෝඩ් එක redirect මෙතඩ් එකේ kill එකක් තියෙනවා. setup and go විදිහට ලියපු කෝඩ් වල පහල කොටස රන් වෙන්නේ. ඒ කියන්නේ මුලින් අවශ්ය දේවල් ටික හදාගෙන (redirect කරන්නේ කොහෙටද, error එකක් විදිහටද, ඉන්ෆෝමේෂන් පෙන්නන්න ඕන ඒවා redirect වෙනකොට වගේ දේවල්), පස්සේ තමයි කෝඩ් එක එක්සිකියුට් කරවන්නේ. event dispatcher වගේ එකකින්, ඒ කියන්නේ වෙනම තැනකින්. ඉතිං ඒක එහෙම කියන්න බැහැ, if එකක බ්ලොක් එකේ අගට die එකක් අනිවා එන්න ඕන කියල නීතියක් විදිහට කියන්න කොහෙවත් බැහැ ඒක ලියන එකා දැනගන්න ඕන ඌ ට අවශ්ය විදිහට රන් කරවන්න. ඕක ඩමියක්, වෙන ඕනෑම දෙයක් වෙන්න පුළුවන් ඔතන, kill නොවී උනත්. උදාහරණයක් විදිහට, [CODE] GuestCounter = $this->getGuestsCount(); if (!$visitor->isMember()) { GuestCounter++ $db->commit(); } $db->commit();[/CODE]ඔතන die එකක් ඕනේ නැහැ. නමුත් db එකට commit වෙනවා. ඒ කෝඩ් එකත් රන් වෙනවා. රන් උනාට දෙවැනි පාර commit වෙන්නේ නැහැ කලින් කරලා නිසා. නැත්තන් මේ වගේ කෝඩ් එකක් ගත්තොත් [CODE] function1{ GuestCounter = $this->getGuestsCount(); if (!$visitor->isMember()) { GuestCounter++ return $visitor; } $db->commit(); } ආපහු වෙන මෙතඩ් එකකදී $membersRepository->setVisitors($guestCounter); $member->save(); [/SIZE] [SIZE=3][/CODE] කියල call කරන්න පුළුවන්.save කරනකොට. ඉතින් එක ලියන විදිහ අනුව වෙනස් වෙනවා. මූ අහල තියෙන්නේ පල්ලෙහා කොටස රන් වෙන්නේ නැහැ කියල කෙලින්ම අපිට කියල. එතකොට කොහොමත් පලවෙනි මෙතඩ් එක තමයි සරල සහ efficient.[/SIZE] [/QUOTE]
Insert quotes…
Verification
Payakata winadi keeyak tibeda?
Post reply
Top
Bottom