public function getNewInstance() { $user = $this->getConfigurationPool()->getContainer()->get('security.context')->getToken()->getUser(); $instance = parent::getNewInstance(); $instance->setUser($user); return $instance; }
public function getNewInstance() { $instance = parent::getNewInstance(); $parent = $this->getRoot()->getSubject(); $instance->setPdfmerge($parent); return $instance; }
public function getNewInstance() { $instance = parent::getNewInstance(); $instance->setCreatedOn(new \DateTime("now")); $instance->setCreatedBy($this->security->getToken()->getUser()); return $instance; }
/** * Setting default values * @inheritdoc */ public function getNewInstance() { $instance = parent::getNewInstance(); $instance->setVisibility('2'); $instance->setCourseLanguage($this->getTranslator()->getLocale()); return $instance; }
public function getNewInstance() { $instance = parent::getNewInstance(); /* @var $instance Employee */ $instance->getProjects()->add($this->projectRepo->findOneBy(['isInternal' => true])); return $instance; }
public function getNewInstance() { $instance = parent::getNewInstance(); $instance->setApplyLimit(-1); $instance->setEnded(new \DateTime()); return $instance; }
/** * @return Menu */ public function getNewInstance() { $site = $this->getCurrentSite(); $instance = parent::getNewInstance(); $instance->setSite($site); return $instance; }
public function getNewInstance() { $instance = parent::getNewInstance(); $instance->setCoordenadaY(self::__DEFAULT_LAT); $instance->setCoordenadaX(self::__DEFAULT_LNG); return $instance; }
/** * {@inheritdoc} */ public function getNewInstance() { $gallery = parent::getNewInstance(); if ($this->hasRequest()) { $gallery->setContext($this->getRequest()->get('context')); } return $gallery; }
/** * {@inheritdoc} */ public function getNewInstance() { $media = parent::getNewInstance(); if ($this->hasRequest()) { $media->setContext($context = $this->getRequest()->get('context')); } return $media; }
/** * {@inheritdoc} */ public function getNewInstance() { $object = parent::getNewInstance(); $inspection = new Inspection(); $inspection->setDate(new \DateTime()); $inspection->setComment("Initial inspection"); $object->addInspection($inspection); return $object; }
public function getNewInstance() { $object = parent::getNewInstance(); $object->setTranslatableLocale($this->getRequest()->getLocale()); foreach (array_keys($this->languages) as $culture) { $object->addTranslation(new BlogTranslation($culture, 'title')); $object->addTranslation(new BlogTranslation($culture, 'content')); } return $object; }
public function getNewInstance() { $date = date("m/d/Y H:i:s"); $datetime = date_create($date); $instance = parent::getNewInstance(); $instance->setDate($datetime); $instance->setTitle("no title "); $instance->setBody("no body "); return $instance; }
public function getNewInstance() { $instance = parent::getNewInstance(); $instance->setEnabled(true); $instance->setValid(true); //$instance->setDirection(1); //$instance->setProject(1); $instance->setDepartment('软件学院'); $instance->setMajor('软件工程'); return $instance; }
public function getNewInstance() { $object = parent::getNewInstance(); $object->setTranslatableLocale($this->getRequest()->getLocale()); foreach (array_keys($this->languages) as $culture) { $object->addTranslation(new AccommodationTranslation($culture, 'title')); $object->addTranslation(new AccommodationTranslation($culture, 'description')); $object->addTranslation(new AccommodationTranslation($culture, 'secondary_text')); } return $object; }
/** * {@inheritdoc} */ public function getNewInstance() { $car = parent::getNewInstance(); $userAdmin = $this->getConfigurationPool()->getAdminByAdminCode('sonata.user.admin.user'); $user = $userAdmin->getModelManager()->findOneBy($userAdmin->getClass(), array('username' => 'admin')); $inspection = new Inspection(); $inspection->setDate(new \DateTime()); $inspection->setComment("Initial inspection"); $inspection->setInspector($user); $car->addInspection($inspection); return $car; }
public function getNewInstance() { //l'objet qu'on crée $instance = parent::getNewInstance(); //requete pour récupérer la derniere page $entity = new \Apa\StoryBundle\Entity\PageBook(); $query = $this->modelManager->getEntityManager($entity)->createQuery('SELECT MAX(p.number) FROM Apa\\StoryBundle\\Entity\\PageBook p')->execute(); //met une valeur au champ number //$instance->setNumber('1'); //var_dump($this );exit; return $instance; }
public function getNewInstance() { $admin = $this->isChild() ? $this->getParent() : $this; $id = $admin->getRequest()->get("id"); $ticket = $this->em->getRepository("MaximModuleTicketBundle:UserTicket")->findOneBy(array("id" => $id)); if (!$ticket) { die("could not find ticket id: " . $id); } $instance = parent::getNewInstance(); $instance->setUserTicket($ticket); $instance->setUser($this->security->getToken()->getUser()); return $instance; }
public function getNewInstance() { $object = parent::getNewInstance(); if ($this->getRequest()->getMethod() !== 'POST') { if ($parentId = $this->getFilteredParentId()) { $object->setParentId($parentId); /** @var ModelManager $modelManager */ $modelManager = $this->getModelManager(); $parent = $modelManager->getEntityManager($this->getClass())->getRepository($this->getClass())->find($parentId); $object->setParent($parent); } } return $object; }
/** * {@inheritdoc} */ public function getNewInstance() { $instance = parent::getNewInstance(); if ($contextId = $this->getPersistentParameter('context')) { $context = $this->contextManager->find($contextId); if (!$context) { $context = $this->contextManager->create(); $context->setEnabled(true); $context->setId($context); $context->setName($context); $this->contextManager->save($context); } $instance->setContext($context); } return $instance; }
/** * {@inheritdoc} */ public function getNewInstance() { $media = parent::getNewInstance(); if ($this->hasRequest()) { if ($this->getRequest()->isMethod('POST')) { $media->setProviderName($this->getRequest()->get(sprintf('%s[providerName]', $this->getUniqid()), null, true)); } else { $media->setProviderName($this->getRequest()->get('provider')); } $media->setContext($context = $this->getRequest()->get('context')); if ($categoryId = $this->getPersistentParameter('category')) { $category = $this->categoryManager->find($categoryId); if ($category && $category->getContext()->getId() == $context) { $media->setCategory($category); } } } return $media; }
public function getNewInstance() { $instance = parent::getNewInstance(); $instance->setEnabled(true); return $instance; }
public function getNewInstance() { $instance = parent::getNewInstance(); $instance->setCreatedOn(new \DateTime("now")); return $instance; }
public function getNewInstance() { $instance = parent::getNewInstance(); if ($this->hasRequest() && $this->getRequest()->get('url')) { $slugs = explode('/', $this->getRequest()->get('url')); $slug = array_pop($slugs); $parent = $this->cmsManager->getPageByUrl(implode('/', $slugs)); if (!$parent) { $parent = $this->cmsManager->getPageByUrl('/'); } $instance->setSlug(urldecode($slug)); $instance->setParent($parent ?: null); $instance->setName(urldecode($slug)); } return $instance; }
/** * {@inheritdoc} */ public function getNewInstance() { $instance = parent::getNewInstance(); if (!$this->hasRequest()) { return $instance; } if ($site = $this->getSite()) { $instance->setSite($site); } if ($site && $this->getRequest()->get('url')) { $slugs = explode('/', $this->getRequest()->get('url')); $slug = array_pop($slugs); try { $parent = $this->pageManager->getPageByUrl($site, implode('/', $slugs)); } catch (PageNotFoundException $e) { try { $parent = $this->pageManager->getPageByUrl($site, '/'); } catch (PageNotFoundException $e) { throw new InternalErrorException('Unable to find the root url, please create a route with url = /'); } } $instance->setSlug(urldecode($slug)); $instance->setParent($parent ?: null); $instance->setName(urldecode($slug)); } return $instance; }
public function getNewInstance() { $instance = parent::getNewInstance(); $instance->setType(Department::DISTRIBUTION_CENTER); return $instance; }
public function getNewInstance() { $instance = parent::getNewInstance(); $instance->setType(Department::BRANCH); return $instance; }
/** * Override method, add default values * {@inheritdoc} */ public function getNewInstance() { $object = parent::getNewInstance(); $object->setAllowedGrantTypes(array('authorization_code', 'refresh_token', 'client_credentials')); return $object; }
public function getNewInstance() { return parent::getNewInstance(); // TODO: Change the autogenerated stub }
public function getNewInstance() { $instance = parent::getNewInstance(); return $instance; }