本文整理汇总了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
}