本文整理匯總了PHP中Sonata\AdminBundle\Admin\Admin::prePersist方法的典型用法代碼示例。如果您正苦於以下問題:PHP Admin::prePersist方法的具體用法?PHP Admin::prePersist怎麽用?PHP Admin::prePersist使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Sonata\AdminBundle\Admin\Admin
的用法示例。
在下文中一共展示了Admin::prePersist方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: prePersist
/**
* @param User $user
*/
public function prePersist($user)
{
parent::prePersist($user);
$user->setIsActive(true);
$user->setRoles(['ROLE_ADMIN']);
$this->password = $user->getPassword();
$usermanager = $this->getConfigurationPool()->getContainer()->get('app.component.usermanager');
$usermanager->hashUserPassword($user);
}
示例2: prePersist
public function prePersist($object)
{
parent::prePersist($object);
$em = $this->getConfigurationPool()->getContainer()->get('doctrine.orm.entity_manager');
$defaultParams = ['opacity' => Slide::DEFAULT_TRANSP_ZONE_OPACITY, 'orientation' => 1, 'size' => Slide::DEFAULT_TRANSP_ZONE_WIDTH, 'color' => Slide::DEFAULT_TRANSP_ZONE_COLOR, 'position' => Slide::DEFAULT_TRANSP_ZONE_POSITION, 'closable' => Slide::DEFAULT_TRANSP_ZONE_CLOSABLE];
$object->setTransparentZoneParameters(serialize($defaultParams));
// Set default transparent zone parameters
if ($object->getDisplayOrder() === NULL) {
$displayOrder = $em->getRepository(Slide::REPOSITORY_CLASS)->findNextSlidesIdInProvidedGallery($object->getParentGallery());
$object->setDisplayOrder($displayOrder);
}
}
示例3: prePersist
public function prePersist($object)
{
parent::prePersist($object);
$this->updateUser($object);
}
示例4: prePersist
public function prePersist($object)
{
if ($object->getType() == 'show') {
$router = $this->getConfigurationPool()->getContainer()->get('router');
$route = $router->getRouteCollection()->get($object->getRouteName());
$parameters = $route->compile()->getVariables();
foreach ($parameters as $parameter) {
$configParameter = new MenuConfigParameter();
$configParameter->setMenuConfig($object);
$configParameter->setParameterKey($parameter);
$object->addParameters($configParameter);
}
}
parent::prePersist($object);
// TODO: Change the autogenerated stub
}