自动获取Getter和Setter性能选项而不是__call

I am looking at options to not having to write getter and setters in my code.

Currently I am using __call to automatically map getters and setters to my properties, however I have been informed that that is very slow.

What options do I have, because writing getters and setters to return properties only is not a very good use of our developer time, and maintaining them is more of a headache

Well, You can use __set(), and __get(), or make public attributes. I haven't heard about any other "magic" methods to do this.

While __call() might not be great in performance, the only alternative I see for you is code generation from an IDE. This also improves the code insight features many recent editors have, allowing the editor to suggest method names while you type code; very handy stuff!

See also: How to generate getter and setter in eclipse (php)

Btw - the __get() and __set() will probably have the same performance issues and introducing them now will dramatically change your existing code (not a good idea).

Edit

I couldn't find any good articles that talk about how to maintain getters and setters dynamically, so I thought of another way (which may or may not work for you).

You could write a code transformer that takes care of the maintenance for you by using either tokenizer or Reflection (or both). This should then be integrated in the IDE as you save it, or it has to be done dynamically every time the file changed.

Anyway, just an idea :)