HomeDevelopmentTips and Tricks for PHP Cake Developers

Tips and Tricks for PHP Cake Developers

There are numerous things that come to you as shock when you create something. Obviously, we are discussing the not very great astonishments that perplex you now and again with the sort of reaction you get while you are not in any manner prepared for it. In light of my encounters I have a couple tips to stem them up and get on with it effectively. Here are the most widely recognized of them:
cake php

1. Not able to validate on create or update

- Advertisement -

Numerous a times we confront a considerable measure of troubles with approval when we are going to finish. This is truly aggravating and gets a hellfire out of you. Better if keep away from it immediately initially when you begin making or refreshing a record document. For this, simply put the $validate exhibit on, when you plan to take a shot at the records. This would spare a considerable measure of your endeavours later on if any section turns out badly.

Must Read —
15 Best PHP Scripts and Tools You Should Use in 2017
20 PHP Tools to Make Developers Work Easier in 2017

2. Not able to get basic information about the table

There are lousy occasions like this where you simply go wiped out tumbling on little issues with nothing working for you. Hang on! Simply take a stab at putting this: pr($this->ModelName->schema()) and you will get the data about the table. It is this simple!

3. Problem with Table Entry

Changes done on table can get somewhat difficult to oversee for the program in the event that they don’t go according to the predefined organize. You confront circumstances when you continue doing changes on table passages and your application doesn’t take them. All you have to do here is clear the reserve. Erase the record from application/tmp/reserve and you will dispose of all the odd things occurring out there.

4. Accessing data session in the view

With the $session aide accessible, all you have to is quite recently put in pr($session). On the off chance that there are now a few factors put in the session, attempt pr($session->read()) and you will be through with it.

5. Losing the extra URL parameters when paginating

This is typical when you are doing some irregular pagination assignment. For a URL, say,/items/see/45, on the off chance that you lose the ID (45) add this line of code to your view: $paginator->options(array(‘url’ => $this->passedArgs)). This will get all of you the required points of interest without a snapshot of strain.

6. Save() does not work!

It get irritating when you pass a summon in CakePHP and it doesn’t fill in according to what you’re realizing guide says. It occurs with Save() a considerable measure. On the off chance that you ever confront this mistake, backpedal and check the approvals you have put. It is conceivable that a portion of the models your entered are neglecting to fulfill the approval principles and bringing about this mistake. A simple and quick approach to do this is putting this summon crosswise over pr($this->validationErrors); in view. This will in a split second show what mistake it is and you will locate a simple way out promptly.

7. Save() still does not work!

On the off chance that despite everything you see it not working, check on the off chance that you have beforeSave() in your model or application demonstrate. Twofold check for the “genuine” esteem in the event that regardless you can’t see it. You will get it this time without a doubt!

8. Checking for a non-empty field in CakePHP 1.2

All things considered, now you have the “notEmpty” govern worked in with the new CakePHP discharge. In this way, the old VALID_NOT_EMPTY steady is not supported any longer by the clients. In any case, as you have no alternative to supplant it with anything, it’s ideal to utilize “lead” => exhibit (‘minLength’, ‘1’) to dispose of it.

- Advertisement -
SkyTechhttp://skytechgeek.com/
I am fun loving guy, addicted to gadgets, technology and web design.
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -

Most Popular