private function createActivity(User $client, $message, $amount) { $activity = new Activity(); $activity->setClientUserId($client->getId()); $activity->setClientStatus($client->getProfile()->getClientStatus()); $activity->setFirstName($client->getFirstName()); $activity->setLastName($client->getLastName()); $activity->setRiaUserId($client->getRia()->getId()); $activity->setAmount($amount); $activity->setMessage($message); $activity->setCreatedAt(new \DateTime()); return $activity; }
/** * Create activity by object * * @param ActivityInterface $object * @return null|Activity */ public function createActivity(ActivityInterface $object) { $client = $object->getActivityClient(); $message = $object->getActivityMessage(); $activity = null; if ($client && $message) { $activity = new Activity(); $activity->setClientUserId($client->getId()); $activity->setClientStatus($client->getProfile()->getClientStatus()); $activity->setFirstName($client->getFirstName()); $activity->setLastName($client->getLastName()); $activity->setRiaUserId($client->getRia()->getId()); $activity->setMessage($message); $activity->setCreatedAt(new \DateTime()); if ($object instanceof PaymentActivityInterface) { $activity->setAmount($object->getActivityAmount()); } } return $activity; }