Bare with me as I outline the set up. I have a db table with the schema id int(10) unsigned ipaddr int(32) unsigned maskbits int(8) unsigned etc. and a web form where the use enters the ip address and mask. The controller and view are easy enough. The model on the other hand is causing problems. As the ip address is entered in the form as "ddd.ddd.ddd.ddd" with a netmask between 0 and 32. This is stored as an integer so as to be able to use sql to do netmask operations, I need to typecast between the two in the model. I found the composed_of directive, but am scratching my head when it comes to applying this to the IPAddr class. It is beginning to look as if I'll have to re-implement the IPAddr class as a value object unless someone cares to give me a few pointers. Is there an esay way to do what I wish to do? Jeff.
on 2005-11-21 07:30