Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Erhnam's avatar

Gynamic getAttribute function with arguments

Does any of you know if it is possible to use dynamic getAttribute function?

I have two tables; Main object table and a details table. The details table has three columns: id to object, property name and property value. The property name I want to incorporate into the getAttribute function. To give you an example; property name can be Animal and property value is Dog. So something like this:

$model->get('animal'); // return "dog";

Is something like this possible?

0 likes
1 reply

Please or to participate in this conversation.