示例#1
0
 public function insertLocation(Document\Location $location, \Craft\UserBundle\Document\User $user, \Symfony\Component\HttpFoundation\Request $request)
 {
     $location->setSlug($this->generateSlug($location->getName()));
     $userDocument = new Document\User($user, $request->getClientIp());
     $location->setCreated($userDocument);
     $this->doctrine->persist($location);
     $this->doctrine->flush();
     $objectId = Acl\ObjectIdentity::fromDomainObject($location);
     $acl = $this->aclProvider->createAcl($objectId);
     $securityId = Acl\UserSecurityIdentity::fromAccount($user);
     $roleId = new Acl\RoleSecurityIdentity('ROLE_LOCATION_MODERATOR');
     return $this;
 }
示例#2
0
 protected function addUpdatedUser(Location $location)
 {
     $user = new User($this->getUser(), $this->getRequest()->getClientIp());
     $location->addUpdated($user);
 }