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
Colombo
Kaduwela - Two Storey House for Sale
dilrasan
Updated:
Yesterday at 2:23 PM
Ad icon
Wechat qr verification
Pawan2005
Updated:
Yesterday at 1:28 AM
🚀 GOOGLE AI PRO 18 MONTHS ACTIVATION 🚀
sayuru bandara
Updated:
Wednesday at 5:34 PM
Pure VPN - Up to 27 Months
vgp
Updated:
Jun 5, 2026
එක පැකේජ් එකයි මාසෙටම Unlimited Internet. තාමත් DATA CARD දාන්න සල්ලි වියදම් කරනවද? අඩුම මිලට අපෙන්.
sayuru bandara
Updated:
Jun 2, 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
Nawa warak dahaya keeyada? (Namaya wadi kireema dahaya)
Post reply
Top
Bottom