本文整理匯總了PHP中models\User::isNew方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::isNew方法的具體用法?PHP User::isNew怎麽用?PHP User::isNew使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類models\User
的用法示例。
在下文中一共展示了User::isNew方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: doSave
/**
* Performs the work of inserting or updating the row in the database.
*
* If the object is new, it inserts it; otherwise an update is performed.
* All related objects are also updated in this method.
*
* @param ConnectionInterface $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @see save()
*/
protected function doSave(ConnectionInterface $con)
{
$affectedRows = 0;
// initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
// We call the save method on the following object(s) if they
// were passed to this object by their corresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
if ($this->aUser !== null) {
if ($this->aUser->isModified() || $this->aUser->isNew()) {
$affectedRows += $this->aUser->save($con);
}
$this->setUser($this->aUser);
}
if ($this->aGroup !== null) {
if ($this->aGroup->isModified() || $this->aGroup->isNew()) {
$affectedRows += $this->aGroup->save($con);
}
$this->setGroup($this->aGroup);
}
if ($this->isNew() || $this->isModified()) {
// persist changes
if ($this->isNew()) {
$this->doInsert($con);
$affectedRows += 1;
} else {
$affectedRows += $this->doUpdate($con);
}
$this->resetModified();
}
$this->alreadyInSave = false;
}
return $affectedRows;
}
示例2: doSave
/**
* Performs the work of inserting or updating the row in the database.
*
* If the object is new, it inserts it; otherwise an update is performed.
* All related objects are also updated in this method.
*
* @param ConnectionInterface $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @see save()
*/
protected function doSave(ConnectionInterface $con)
{
$affectedRows = 0;
// initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
// We call the save method on the following object(s) if they
// were passed to this object by their corresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
if ($this->aOwner !== null) {
if ($this->aOwner->isModified() || $this->aOwner->isNew()) {
$affectedRows += $this->aOwner->save($con);
}
$this->setOwner($this->aOwner);
}
if ($this->isNew() || $this->isModified()) {
// persist changes
if ($this->isNew()) {
$this->doInsert($con);
$affectedRows += 1;
} else {
$affectedRows += $this->doUpdate($con);
}
$this->resetModified();
}
if ($this->usersScheduledForDeletion !== null) {
if (!$this->usersScheduledForDeletion->isEmpty()) {
$pks = array();
foreach ($this->usersScheduledForDeletion as $entry) {
$entryPk = [];
$entryPk[1] = $this->getId();
$entryPk[0] = $entry->getId();
$pks[] = $entryPk;
}
\Models\UserGroupQuery::create()->filterByPrimaryKeys($pks)->delete($con);
$this->usersScheduledForDeletion = null;
}
}
if ($this->collUsers) {
foreach ($this->collUsers as $user) {
if (!$user->isDeleted() && ($user->isNew() || $user->isModified())) {
$user->save($con);
}
}
}
if ($this->packPermissionsScheduledForDeletion !== null) {
if (!$this->packPermissionsScheduledForDeletion->isEmpty()) {
\Models\PackPermissionQuery::create()->filterByPrimaryKeys($this->packPermissionsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
$this->packPermissionsScheduledForDeletion = null;
}
}
if ($this->collPackPermissions !== null) {
foreach ($this->collPackPermissions as $referrerFK) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->userGroupsScheduledForDeletion !== null) {
if (!$this->userGroupsScheduledForDeletion->isEmpty()) {
\Models\UserGroupQuery::create()->filterByPrimaryKeys($this->userGroupsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
$this->userGroupsScheduledForDeletion = null;
}
}
if ($this->collUserGroups !== null) {
foreach ($this->collUserGroups as $referrerFK) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con);
}
}
}
$this->alreadyInSave = false;
}
return $affectedRows;
}
示例3: doSave
/**
* Performs the work of inserting or updating the row in the database.
*
* If the object is new, it inserts it; otherwise an update is performed.
* All related objects are also updated in this method.
*
* @param ConnectionInterface $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @see save()
*/
protected function doSave(ConnectionInterface $con)
{
$affectedRows = 0;
// initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
// We call the save method on the following object(s) if they
// were passed to this object by their corresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
if ($this->aUser !== null) {
if ($this->aUser->isModified() || $this->aUser->isNew()) {
$affectedRows += $this->aUser->save($con);
}
$this->setUser($this->aUser);
}
if ($this->aCategory !== null) {
if ($this->aCategory->isModified() || $this->aCategory->isNew()) {
$affectedRows += $this->aCategory->save($con);
}
$this->setCategory($this->aCategory);
}
if ($this->isNew() || $this->isModified()) {
// persist changes
if ($this->isNew()) {
$this->doInsert($con);
$affectedRows += 1;
} else {
$affectedRows += $this->doUpdate($con);
}
$this->resetModified();
}
if ($this->subNotesScheduledForDeletion !== null) {
if (!$this->subNotesScheduledForDeletion->isEmpty()) {
\Models\SubNoteQuery::create()->filterByPrimaryKeys($this->subNotesScheduledForDeletion->getPrimaryKeys(false))->delete($con);
$this->subNotesScheduledForDeletion = null;
}
}
if ($this->collSubNotes !== null) {
foreach ($this->collSubNotes as $referrerFK) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->filesScheduledForDeletion !== null) {
if (!$this->filesScheduledForDeletion->isEmpty()) {
\Models\FileQuery::create()->filterByPrimaryKeys($this->filesScheduledForDeletion->getPrimaryKeys(false))->delete($con);
$this->filesScheduledForDeletion = null;
}
}
if ($this->collFiles !== null) {
foreach ($this->collFiles as $referrerFK) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->notificationsScheduledForDeletion !== null) {
if (!$this->notificationsScheduledForDeletion->isEmpty()) {
foreach ($this->notificationsScheduledForDeletion as $notification) {
// need to save related object because we set the relation to null
$notification->save($con);
}
$this->notificationsScheduledForDeletion = null;
}
}
if ($this->collNotifications !== null) {
foreach ($this->collNotifications as $referrerFK) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->commentsScheduledForDeletion !== null) {
if (!$this->commentsScheduledForDeletion->isEmpty()) {
\Models\CommentQuery::create()->filterByPrimaryKeys($this->commentsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
$this->commentsScheduledForDeletion = null;
}
}
if ($this->collComments !== null) {
foreach ($this->collComments as $referrerFK) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->sharedsScheduledForDeletion !== null) {
if (!$this->sharedsScheduledForDeletion->isEmpty()) {
//.........這裏部分代碼省略.........
示例4: doSave
/**
* Performs the work of inserting or updating the row in the database.
*
* If the object is new, it inserts it; otherwise an update is performed.
* All related objects are also updated in this method.
*
* @param ConnectionInterface $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @see save()
*/
protected function doSave(ConnectionInterface $con)
{
$affectedRows = 0;
// initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
// We call the save method on the following object(s) if they
// were passed to this object by their corresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
if ($this->aUser !== null) {
if ($this->aUser->isModified() || $this->aUser->isNew()) {
$affectedRows += $this->aUser->save($con);
}
$this->setUser($this->aUser);
}
if ($this->aArticle !== null) {
if ($this->aArticle->isModified() || $this->aArticle->isNew()) {
$affectedRows += $this->aArticle->save($con);
}
$this->setArticle($this->aArticle);
}
if ($this->isNew() || $this->isModified()) {
// persist changes
if ($this->isNew()) {
$this->doInsert($con);
$affectedRows += 1;
} else {
$affectedRows += $this->doUpdate($con);
}
$this->resetModified();
}
if ($this->ratingsScheduledForDeletion !== null) {
if (!$this->ratingsScheduledForDeletion->isEmpty()) {
\Models\RatingQuery::create()->filterByPrimaryKeys($this->ratingsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
$this->ratingsScheduledForDeletion = null;
}
}
if ($this->collRatings !== null) {
foreach ($this->collRatings as $referrerFK) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con);
}
}
}
$this->alreadyInSave = false;
}
return $affectedRows;
}