Пример #1
0
 /**
  * Save ip
  *
  * @param array $values
  * @return Newscoop\Entity\User\Ip
  */
 public function save(array $values)
 {
     $ip = new Ip($values['ip'], $values['number']);
     if (array_key_exists('user', $values)) {
         $ip->setUser(is_numeric($values['user']) ? $this->em->getReference('Newscoop\\Entity\\User', $values['user']) : $values['user']);
     }
     $this->em->persist($ip);
     $this->em->flush($ip);
     return $ip;
 }
Пример #2
0
 /**
  * Get json representation of subscription ip
  *
  * @param Newscoop\Entity\User\Ip $ip
  * @return array
  */
 public function SubscriptionIpJson(\Newscoop\Entity\User\Ip $ip)
 {
     return array('ip' => $ip->getIp(), 'number' => $ip->getNumber(), 'id' => implode(':', array($ip->getUserId(), $ip->getIp())));
 }
 public function getUserId()
 {
     $this->__load();
     return parent::getUserId();
 }