Liquid Fire Posted March 2, 2008 Share Posted March 2, 2008 do you think it is bad practice to create class members dynamically? Like i have my mvc framework and i have a list of companies. for each company on this page i want to create a mvc link and i have a url_helper class to generate one for me. Now the best way to like this link to the company is to have it as a member however the company model class does not need this member part of it always. is it bad practice to add the link to the company class dynamically? is there a better way to link the link to the object if so? The only other way is to have the code to generate the link inside the view file but the view file is a xtemplate file so i can't do that Quote Link to comment https://forums.phpfreaks.com/topic/94047-adding-members-to-objects-dynamically/ Share on other sites More sharing options...
able Posted March 3, 2008 Share Posted March 3, 2008 Why can't your url_helper or other class/method/function simply take an object, plus the name of the field of the object which is a url and use it to create your link? Quote Link to comment https://forums.phpfreaks.com/topic/94047-adding-members-to-objects-dynamically/#findComment-482096 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.