本文整理汇总了PHP中Properties::createNewProperie方法的典型用法代码示例。如果您正苦于以下问题:PHP Properties::createNewProperie方法的具体用法?PHP Properties::createNewProperie怎么用?PHP Properties::createNewProperie使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Properties
的用法示例。
在下文中一共展示了Properties::createNewProperie方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createSignUp
/**
*
* @param usersData $data
* @return type
*/
public function createSignUp($data)
{
$format = $data->format;
if ($format == 'doc') {
$body = $this->renderPartial('auth/doc', array(), true);
return $this->response->type('json')->goodResponse($body);
}
$tutModel = new Tutorial();
$propModel = new Properties();
$userModel = new Users();
$user2PropertyModel = new \User2property();
$transaction = $propModel->dbConnection->beginTransaction();
$propertie = $propModel->createNewProperie($data->propertie, $data->PP_TRIAL);
$tutModel->save();
$tutorial = $tutModel->id;
if ($propertie !== false || $tutorial !== false) {
$data->property_id = $propertie;
$data->tutorial_id = $tutorial;
$user = $userModel->createNewUser((array) $data);
if ($user !== false) {
$color = 'type1';
$bName = $data->firstname . ' ' . $data->lastname;
$user2PropertyModel->unsetAttributes();
$user2PropertyModel->setAttributes(array('userId' => $user, 'propertyId' => $propertie, 'access' => self::OWNER, 'status' => self::STATUS_ACTIVE, 'color' => 'type1', 'bookingName' => $bName));
if ($user2PropertyModel->save()) {
$transaction->commit();
$result = true;
} else {
$transaction->rollback();
$result = false;
}
} else {
$transaction->rollback();
$result = false;
}
} else {
$transaction->rollback();
$result = false;
}
$view = !$result ? 'signup/error' : 'signup/done';
$body = $this->renderPartial($view, array('format' => $format), true);
return $this->response->type('json')->goodResponse($body);
}