Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8287137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:57:11+00:00 2026-06-08T11:57:11+00:00

I am extensively using magic methods for lots of purpose like common setters and

  • 0

I am extensively using magic methods for lots of purpose like common setters and getter, Implemented wrapper classes using __call(). Now have studied doctrine and I wondered they haven’t used magic getter and setters actually they do not work if we specify in the models.

So my questions are HOW doctrine have abbreviated magic methods? and what are the disadvantages of using magic methods specifically in ORM like docterine ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T11:57:12+00:00Added an answer on June 8, 2026 at 11:57 am
    • Magic code is hard to document and understand. Usually you should add
      a comment to every function and use a tool to generate a
      documentation. This will not work with magic methods.

    • Magic methods do not support type hinting.
      One of the greatest advantages of using functions to set properties is that you can use type hinting. Code like this

      public function setUser(User $user){ this->user = $user }

      makes sure that the user property will allways contain a valid user object or null.

    • IDEs do not support magic methods.
      Many modern PHP IDEs support auto complete. Functions and methods are recognized by a simple parser. This parser is not able to detect magic get set or call operations.

    I heard that that magic methods are slower then explicit methods but I have never tested it myself.

    So how do you do it without magic?
    I use templates to generate geters and setters and usually I do not use __call at all.

    Magic methods are very usefull tools for creating proxy objects and and other specialized tools but you SHOULD NOT use them in every class

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a graphics application that is using virtual classes fairly extensively. It
I have started using c++ extensively in school and now my programs are getting
We're extensively using NHibernate multi-query functionality and experiencing strange behavior. Seems like NHibernate does
I am extensively using H2 database for my project (lots of inserts and selects)
I am extensively using declarative dojo DataStores in my application and connecting them to
I am developing a website which is extensively using jquery dom javascript ajax etc.
In my project, I am extensively using boost asio to be able to uniformly
In my application I am using extensively glTexImage2D. I copy some image of an
I'm working on a website using extensively javascript. The code I'm working on also
I'm using the following code-snippet extensively in my model templates. <div class=control-group> @Html.LabelFor(model =>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.