0

I am a developer trying to learn magento. I learned the basic things like make a simple module, a simple widget nothing complicated at all.

But when I have to use a object function, I do not know what it does. How can I know what does that function do?

I am not saying a concret function because I want to know how to find out what it does without asking here the concret function.

Also there is a web page where all the functions are located? (and easy to use)

1
  • 1
    how can you know what any function does in any application?
    – Marius
    Jun 21, 2016 at 11:28

2 Answers 2

4

The best way to know what a function does is read the source code. There are many ways to do that:

  • using a documentation generator, eg, doxygen
  • using an IDE, eg, PhpStorm
  • using a text search in the OS, eg, win10 can do the job
  • using github
4
  • But that have a problem. Imagine I try to search one fucntion wich have instancied other name and replicate these few time more. For urderstand a fuction I will have to lose much time trying to understand several fuctions. Jun 21, 2016 at 10:36
  • 3
    Exactly. This is how software, frameworks and programmings works. You know what the php library functions do, how objects work, then you implement or read methods and they are interconnected to each other. If they call each other you need to understand what they all do, to understand what really happens. Most of the time this is not needed. A method has a name and with time you get a feeling what is going on. Then you have a terrible bug/feature request and you read code until you understand where to hook into and how to do/fix things. Jun 21, 2016 at 11:44
  • But not always I have time for read 500 lines of code and understand it. Is there other faster solution? Jun 21, 2016 at 13:21
  • Yes, sometimes even after reading the code, I cannot figure out what it does. In this situation, I write some test code and call that function directly. On a test or development server, I even add code or modified the core code. Very rarely I need to tear it apart to understand the code. After all is clear, I undo the changes to the core.
    – kiatng
    Jun 22, 2016 at 3:54
1

The Magento Docs explain the core Magento classes.

Figuring out how these classes work together can be done by reading the existing code. kiatng has listed a few ways on how to do this in his answer.

1
  • I saw Magento Docs but It is not easy to use. It is dificult for me wich I have satarted with magento recently Jun 21, 2016 at 10:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.