C
C
cybernoob2018-02-15 15:05:41
PHP
cybernoob, 2018-02-15 15:05:41

How to access a non-existent method?

There is a site address structure of the form:
domain.com/job/all - the entire directory
domain.com/job/profession/25 - a section with a specific profession and 25 - resume id
The job controller class is launched, then the profession ($) method should be called id) but the bottom line is that all sections and all professions must be processed in exactly the same way, with one model and displayed in one view, it’s stupid to produce the same methods ... Is it possible to do in the job class:

public function __call($id ) 
{

}

Then all requests to non-existent methods will be redirected to it
public function cleaner($id){}
public function profession($id){}
and it will process all these requests.
Is this a very bad idea?

Answer the question

In order to leave comments, you need to log in

12 answer(s)
R
roswell, 2018-02-15
@cybernoob

__call()

6
65520, 2012-08-18
@65520

In order to become a programmer, you will have to read more than a dozen books, and not all of them will be written in an easy and understandable language (there are actually only a few of them). And you want to sleep already on the first ...
And so try Thinking in Java - it is written perfectly, everything is chewed, and, most importantly, everything is consistent. I do not actively program in Java, but I leaf through this book from time to time just for fun :)

A
Alexey Bykhun, 2012-08-18
@caffeinum

If you are too lazy to read, try starting with codecademy.com
True, there is no PHP there, but there is Python and Javascript)
But then, of course, you should read serious books.

T
twenty, 2012-08-18
@twenty

Of course, English should be chosen as the first language studied , since almost all the literature you are interested in will be in it.
If the level of English allows you to perceive the delivered speech of native speakers, as well as read technical literature “with a dictionary”, you can begin to enjoy all the benefits of progressive learning.
For example, a theoretical part about programming in Python can be found at Khan Academy . The practical part is also there, but, unfortunately, only for JavaScript. In defense, I’ll say that the JavaScript lessons were written by John Resig (creator of jQuery).
For practice, try another resource that teaches you through trial and error: Codeacademy. Recently, the first few python lessons have been added to it. I'm sure by the time you get to the last one, more will be added.
In addition, I recommend enrolling and taking a fun Harvard CS50x course on the basics of programming. In iTunes (perhaps not only in it) you can find videos from previous courses.

A
anathem, 2012-08-18
@anathem

It’s just worth finding a good book, thinking up interesting tasks for yourself and looking for ways to solve them. I wrote a post some time ago that might be useful. There are resources, but for Ruby.

S
Stdit, 2012-08-18
@Stdit

Theory must be mixed with practice, do-remake fictitious puzzles, delve into mana, try to understand how everything works. I started with visual programs, with graphics, the simplest demoscenes, mini-games, etc., because it was more pleasant for me to perceive the result and I did not want to sleep until the morning. As for the language, it's a matter of taste and preference. Now many people start with Javascript because of its accessibility, unpretentiousness and relative simplicity (in terms of “writing something”, understanding what programming is in general). It is also useful to read forums and other communities, especially other people's complaints and problems and the answers to them (like here or on stackoverflow ).

E
Egor Nikitin, 2015-04-04
@clicacidin37

It's good to start with an android, a low entry threshold and you can see the result, which you can even show to your loved ones :).
There is a good course from Google.
Start right away with English .

N
Nikolai Turnaviotov, 2012-08-18
@foxmuldercp

tasks must be set and solved. I learned powershell and bash when I had to tinker with automating video processing from webcams and creating backups, then I switched to c# for Windows and phones.

K
KONSTANTIN12, 2012-08-19
@KONSTANTIN12

thank you very much ... what a pity that I do not speak English at the proper level

O
OlderThenOldest, 2014-07-05
@OlderThenOldest

An excellent resource where they learn to program in Java, I went through it myself, and I recommend it to all my friends: JavaRush (If you think it's advertising spam, try going through a few lessons, you will be pleasantly surprised)

A
Azgard2015, 2015-01-21
@Azgard2015

a very good method to learn how to program it on javarush.ru/user/reference/20c56b1e-0ad5-4139-8e1d... I started here myself and very successfully here as a game it's not boring and useful

W
Whishmaster111111, 2015-01-22
@Whishmaster111111

Based on reviews, I found the best resource on the Internet for teaching JAVA programmers. Maybe someone heard negative reviews, I did not find something? javarush.ru/user/reference/aa7bb646-c415-4001-a9af...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question