MySQL has built-in functionality for this with its inet_aton and  
inet_ntoa functions.

I'm not entirely sure how you'd be able to use these from Doctrine or  
Propel though.

PHP also has built-in ip2long and long2ip which achieve the same.

I don't understand your push v's pull problem :-/

You said you're going to set IP in the action - presumably something  
like $user->setIp($_SERVER['REMOTE_ADDR'])

I assume this is what you mean by 'push'?

if you don't want to use a setter, you'll have to set the property in  
the constructor for $user like I mentioned before....

class user {
   private $ip;
   public function __construct() {
     $this->ip = $_SERVER['REMOTE_ADDR'];
   }

   pubic function getIp() {
     return $this->ip;
   }
}



On 21 Mar 2009, at 19:44, Benjamin wrote:

> 2.  I will set the ip using the action.  The setIp method will convert
> it into an integer.  I know there were some recommendations about
> creating a method to retrieve the IP from, but I can't figure out a
> good way to implement a system where the IP is pulled into the User
> model, rather than Pushed into it.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to