xml version="1.0" encoding="UTF-8" ?>
The DbExchange class is used to track the VO instances that have been instantiated (specifically new, updated, & deleted VOs). The class maintains arrays of the objects that have been created during script execution. The modifications are performed in the background (mostly).
When various different stages of script completion are reached, you can call on the DbExchange to perform the accumulated database operations all at once (with the exception of the SELECTs). The operations can be performed by type, or just perform all of them.
The following script(s) utilize the other VoDaoDb classes to perform their intended purposes. The contents of the DbExchange are echoed throughout so that you can follow the changes being performed. Note the use of "mark???()" methods, as opposed to the "???Now()" methods used on the Value Objects, on the VOs. Either method can be used, but the DbExchange does accumulate the changes before they're committed to the database. This helps to save trips to the database. Contrarily, the "???Now()" methods will perform the database synchronization immediately even if the object is modified or deleted again before the script exits.
echo "Line #" . __LINE__ . DbTest::Broker();
Line #53DbExchange::Summary
(0) Clean VOs: *Empty* (0) New VOs: *Empty* (0) Dirty VOs: *Empty* (0) Deleted VOs: *Empty* (0) All VOs: *Empty*
$newUser1 = new UserVO();
$newUser1->init(array("username"=>"theUsername","pwd"=>"thePwd"));
UserVO::init() Setting Properties With: Array
(
[username] => theUsername
[pwd] => thePwd
)
$newUser1->markNew();//Explicitly mark it as a new instance.
AbstractValueObject::markNew()
DbExchange::addNew()
Marked As New: (UserVO) { Key: -1, user_id: -1, username: “theUsername”, pwd: “thePwd” }
Line #97DbExchange::Summary
(0) Clean VOs: *Empty* (1) New VOs:
Key '0': (UserVO) { Key: -1, user_id: -1, username: “theUsername”, pwd: “thePwd” }
(0) Dirty VOs: *Empty* (0) Deleted VOs: *Empty* (0) All VOs: *Empty*
DbTest::Broker()->commitInserts();
Inserting (1) VO objects...
Removed New #1 : (UserVO) { Key: -1, user_id: -1, username: “theUsername”, pwd: “thePwd” }
UserDbMap::insertNow()
Inserting (UserVO) { Key: -1, user_id: -1, username: “theUsername”, pwd: “thePwd” } in `user`
UserDbMap::insertNow() Insert successful
Setting new user id...
UserVO::setUserId() setting new value: “41918”
DbExchange::addClean()
Added to aryAll: (UserVO) { Key: 41918, user_id: 41918, username: “theUsername”, pwd: “thePwd” }.
Added to aryClean: (UserVO) { Key: 41918, user_id: 41918, username: “theUsername”, pwd: “thePwd” }.
Trim aryDirty. Trim aryDeleted. Trimming aryDeleted and aryDirty
Marked As Clean: (UserVO) { Key: 41918, user_id: 41918, username: “theUsername”, pwd: “thePwd” }
echo "Line #" . __LINE__ . DbTest::Broker();
Line #122DbExchange::Summary
(1) Clean VOs:
Key 'UserVO.41918': (UserVO) { Key: 41918, user_id: 41918, username: “theUsername”, pwd: “thePwd” }
(0) New VOs: *Empty* (0) Dirty VOs: *Empty* (0) Deleted VOs: *Empty* (1) All VOs:
Key 'UserVO.41918': (UserVO) { Key: 41918, user_id: 41918, username: “theUsername”, pwd: “thePwd” }
$newUser2 = new UserVO();
$time = date("h:i:s"); //Value: '12:56:52'
$newPwd = substr( md5($time),0,6); //Value: '462899'
$newUser2->setUsername("Username$time")->setPwd($newPwd)->markNew();
UserVO::setUsername() setting new value: “Username12:56:52”
UserVO::setPwd() setting new value: “462899”
AbstractValueObject::markNew()
DbExchange::addNew()
Marked As New: (UserVO) { Key: -1, user_id: -1, username: “Username12:56:52”, pwd: “462899” }
Line #156DbExchange::Summary
(1) Clean VOs:
Key 'UserVO.41918': (UserVO) { Key: 41918, user_id: 41918, username: “theUsername”, pwd: “thePwd” }
(1) New VOs:
Key '0': (UserVO) { Key: -1, user_id: -1, username: “Username12:56:52”, pwd: “462899” }
(0) Dirty VOs: *Empty* (0) Deleted VOs: *Empty* (1) All VOs:
Key 'UserVO.41918': (UserVO) { Key: 41918, user_id: 41918, username: “theUsername”, pwd: “thePwd” }
DbTest::Broker()->commitInserts();
echo "
Line #" . __LINE__ . DbTest::Broker();
Inserting (1) VO objects...
Removed New #1 : (UserVO) { Key: -1, user_id: -1, username: “Username12:56:52”, pwd: “462899” }
UserDbMap::insertNow()
Inserting (UserVO) { Key: -1, user_id: -1, username: “Username12:56:52”, pwd: “462899” } in `user`
UserDbMap::insertNow() Insert successful
Setting new user id...
UserVO::setUserId() setting new value: “41919”
DbExchange::addClean()
Added to aryAll: (UserVO) { Key: 41919, user_id: 41919, username: “Username12:56:52”, pwd: “462899” }.
Added to aryClean: (UserVO) { Key: 41919, user_id: 41919, username: “Username12:56:52”, pwd: “462899” }.
Trim aryDirty. Trim aryDeleted. Trimming aryDeleted and aryDirty
Marked As Clean: (UserVO) { Key: 41919, user_id: 41919, username: “Username12:56:52”, pwd: “462899” }
Line #169DbExchange::Summary
(2) Clean VOs:
Key 'UserVO.41918': (UserVO) { Key: 41918, user_id: 41918, username: “theUsername”, pwd: “thePwd” }
Key 'UserVO.41919': (UserVO) { Key: 41919, user_id: 41919, username: “Username12:56:52”, pwd: “462899” }
(0) New VOs: *Empty* (0) Dirty VOs: *Empty* (0) Deleted VOs: *Empty* (2) All VOs:
Key 'UserVO.41918': (UserVO) { Key: 41918, user_id: 41918, username: “theUsername”, pwd: “thePwd” }
Key 'UserVO.41919': (UserVO) { Key: 41919, user_id: 41919, username: “Username12:56:52”, pwd: “462899” }
$existingUser = $newUser1->map()->findByUserId(3);
echo $existingUser
UserDbMap::findByKeyNow() using: Array
(
[user_id] => 3
)
UserDbMap::getInstance() Creating new UserVO and calling init()
UserVO::init() Setting Properties With: Array
(
[user_id] => 3
[username] => Therese_25
[pwd] => eccb_3
)
(UserVO) { Key: 3, user_id: 3, username: “Therese_25”, pwd: “eccb_3” }
Line #206DbExchange::Summary
(2) Clean VOs:
Key 'UserVO.41918': (UserVO) { Key: 41918, user_id: 41918, username: “theUsername”, pwd: “thePwd” }
Key 'UserVO.41919': (UserVO) { Key: 41919, user_id: 41919, username: “Username12:56:52”, pwd: “462899” }
(0) New VOs: *Empty* (0) Dirty VOs: *Empty* (0) Deleted VOs: *Empty* (2) All VOs:
Key 'UserVO.41918': (UserVO) { Key: 41918, user_id: 41918, username: “theUsername”, pwd: “thePwd” }
Key 'UserVO.41919': (UserVO) { Key: 41919, user_id: 41919, username: “Username12:56:52”, pwd: “462899” }
$userTableSelector = new UserSelector(2);//Prep to select `user`.`user_id` = 2
echo $userTableSelector->sqlWhereClause();//Echo the where clause to inspect it
WHERE `user`.`user_id` = 2
$resultCollection = $userTableSelector->fetch();//Run the query and return any match/matches in an AbstractValueObject
AbstractSelector::fetch() using query: “SELECT * FROM `user` WHERE `user`.`user_id` = 2”
Because a selection result could potentially have more than one row, fetch() always returns a “collection” object.
echo get_class($resultCollection) . " implementation of... " . $resultCollection;
UserCollection implementation of... AbstractCollection::__toString()
Raw VO Data (Total = 1):
Raw 0: Array
(
[user_id] => 2
[username] => Method3User
[pwd] => Method3Pwd
)
Built UserVO Objects (Total = 0 of 1):
Line #245DbExchange::Summary
(2) Clean VOs:
Key 'UserVO.41918': (UserVO) { Key: 41918, user_id: 41918, username: “theUsername”, pwd: “thePwd” }
Key 'UserVO.41919': (UserVO) { Key: 41919, user_id: 41919, username: “Username12:56:52”, pwd: “462899” }
(0) New VOs: *Empty* (0) Dirty VOs: *Empty* (0) Deleted VOs: *Empty* (2) All VOs:
Key 'UserVO.41918': (UserVO) { Key: 41918, user_id: 41918, username: “theUsername”, pwd: “thePwd” }
Key 'UserVO.41919': (UserVO) { Key: 41919, user_id: 41919, username: “Username12:56:52”, pwd: “462899” }
$rowInstance = $resultCollection->current();
AbstractCollection::getRow()
Building and returning UserVO #0
AbstractDbTableMap::getVO() delegating to concrete class....
UserDbMap::getInstance() Creating new UserVO and calling init()
UserVO::init() Setting Properties With: Array
(
[user_id] => 2
[username] => Method3User
[pwd] => Method3Pwd
)
echo $rowInstance;
(UserVO) { Key: 2, user_id: 2, username: “Method3User”, pwd: “Method3Pwd” }
Line #273DbExchange::Summary
(2) Clean VOs:
Key 'UserVO.41918': (UserVO) { Key: 41918, user_id: 41918, username: “theUsername”, pwd: “thePwd” }
Key 'UserVO.41919': (UserVO) { Key: 41919, user_id: 41919, username: “Username12:56:52”, pwd: “462899” }
(0) New VOs: *Empty* (0) Dirty VOs: *Empty* (0) Deleted VOs: *Empty* (2) All VOs:
Key 'UserVO.41918': (UserVO) { Key: 41918, user_id: 41918, username: “theUsername”, pwd: “thePwd” }
Key 'UserVO.41919': (UserVO) { Key: 41919, user_id: 41919, username: “Username12:56:52”, pwd: “462899” }
$newCollection = $userTableSelector->select()->userId(">", 7)->andWith()->username("LIKE", "%ernam%")->limit(5)->orderBy("user_id", "DESC")->fetch();
echo $newCollection;
AbstractSelector::fetch() using query: “SELECT * FROM `user` WHERE `user`.`user_id` > 7 AND `user`.`username` LIKE '%ernam%' ORDER BY user_id DESC LIMIT 5, 1 ”
AbstractCollection::__toString()
Raw VO Data (Total = 0):
Built UserVO Objects (Total = 0 of 0):
$newCollection = $userTableSelector->select()->userId(">", 7)->andWith()->userId("<", "50")->limit(6)->orderBy("RAND()", "")->fetch();
echo $newCollection;
AbstractSelector::fetch() using query: “SELECT * FROM `user` WHERE `user`.`user_id` > 7 AND `user`.`user_id` < 50 ORDER BY RAND() LIMIT 6, 1 ”
AbstractCollection::__toString()
Raw VO Data (Total = 0):
Built UserVO Objects (Total = 0 of 0):
$rowInstance->setUsername("Method1User");
$rowInstance->setPwd("Method1Pwd");
$rowInstance->markDirty();
UserVO::setUsername() setting new value: “Method1User”
UserVO::setPwd() setting new value: “Method1Pwd”
AbstractValueObject::markDirty()
DbExchange::addDirty()
Added to aryAll: (UserVO) { Key: 2, user_id: 2, username: “Method1User”, pwd: “Method1Pwd” }.
Added to aryDirty: (UserVO) { Key: 2, user_id: 2, username: “Method1User”, pwd: “Method1Pwd” }.
Trimming aryNew, aryClean, and aryDeleted
Marked As Dirty: (UserVO) { Key: 2, user_id: 2, username: “Method1User”, pwd: “Method1Pwd” }
Line #337DbExchange::Summary
(2) Clean VOs:
Key 'UserVO.41918': (UserVO) { Key: 41918, user_id: 41918, username: “theUsername”, pwd: “thePwd” }
Key 'UserVO.41919': (UserVO) { Key: 41919, user_id: 41919, username: “Username12:56:52”, pwd: “462899” }
(0) New VOs: *Empty* (1) Dirty VOs:
Key 'UserVO.2': (UserVO) { Key: 2, user_id: 2, username: “Method1User”, pwd: “Method1Pwd” }
(0) Deleted VOs: *Empty* (3) All VOs:
Key 'UserVO.41918': (UserVO) { Key: 41918, user_id: 41918, username: “theUsername”, pwd: “thePwd” }
Key 'UserVO.41919': (UserVO) { Key: 41919, user_id: 41919, username: “Username12:56:52”, pwd: “462899” }
Key 'UserVO.2': (UserVO) { Key: 2, user_id: 2, username: “Method1User”, pwd: “Method1Pwd” }
$rowInstance->init(array('username'=>'Method2User','pwd'=>'Method2Pwd'))->markDirty();
UserVO::init() Setting Properties With: Array
(
[username] => Method2User
[pwd] => Method2Pwd
)
AbstractValueObject::markDirty()
DbExchange::addDirty()
Trimming aryNew, aryClean, and aryDeleted
Marked As Dirty: (UserVO) { Key: 2, user_id: 2, username: “Method2User”, pwd: “Method2Pwd” }
Current $rowInstance values: (UserVO) { Key: 2, user_id: 2, username: “Method2User”, pwd: “Method2Pwd” }
Method 3: Chaining methods.
$rowInstance->setUsername("Method3User")->setPwd("Method3Pwd")->markDirty();
-- This is identical to --
$rowInstance->setUsername("Method3User");
$rowInstance->setPwd("Method3Pwd");
$rowInstance->markDirty();
UserVO::setUsername() setting new value: “Method3User”
UserVO::setPwd() setting new value: “Method3Pwd”
AbstractValueObject::markDirty()
DbExchange::addDirty()
Trimming aryNew, aryClean, and aryDeleted
Marked As Dirty: (UserVO) { Key: 2, user_id: 2, username: “Method3User”, pwd: “Method3Pwd” }
Current $rowInstance values: (UserVO) { Key: 2, user_id: 2, username: “Method3User”, pwd: “Method3Pwd” }
Line #375DbExchange::Summary
(2) Clean VOs:
Key 'UserVO.41918': (UserVO) { Key: 41918, user_id: 41918, username: “theUsername”, pwd: “thePwd” }
Key 'UserVO.41919': (UserVO) { Key: 41919, user_id: 41919, username: “Username12:56:52”, pwd: “462899” }
(0) New VOs: *Empty* (1) Dirty VOs:
Key 'UserVO.2': (UserVO) { Key: 2, user_id: 2, username: “Method3User”, pwd: “Method3Pwd” }
(0) Deleted VOs: *Empty* (3) All VOs:
Key 'UserVO.41918': (UserVO) { Key: 41918, user_id: 41918, username: “theUsername”, pwd: “thePwd” }
Key 'UserVO.41919': (UserVO) { Key: 41919, user_id: 41919, username: “Username12:56:52”, pwd: “462899” }
Key 'UserVO.2': (UserVO) { Key: 2, user_id: 2, username: “Method3User”, pwd: “Method3Pwd” }
for($i=0; $i < 10; $i++){
$userObject = new UserVO();
$userObject->setUsername("Username$i");
$userObject->setPwd(substr(md5($i), 0, 7));
$userObject->markNew();
echo "<hr/>";
}
UserVO::setUsername() setting new value: “Username0”
UserVO::setPwd() setting new value: “cfcd208”
AbstractValueObject::markNew()
DbExchange::addNew()
Marked As New: (UserVO) { Key: -1, user_id: -1, username: “Username0”, pwd: “cfcd208” }
UserVO::setUsername() setting new value: “Username1”
UserVO::setPwd() setting new value: “c4ca423”
AbstractValueObject::markNew()
DbExchange::addNew()
Marked As New: (UserVO) { Key: -1, user_id: -1, username: “Username1”, pwd: “c4ca423” }
UserVO::setUsername() setting new value: “Username2”
UserVO::setPwd() setting new value: “c81e728”
AbstractValueObject::markNew()
DbExchange::addNew()
Marked As New: (UserVO) { Key: -1, user_id: -1, username: “Username2”, pwd: “c81e728” }
UserVO::setUsername() setting new value: “Username3”
UserVO::setPwd() setting new value: “eccbc87”
AbstractValueObject::markNew()
DbExchange::addNew()
Marked As New: (UserVO) { Key: -1, user_id: -1, username: “Username3”, pwd: “eccbc87” }
UserVO::setUsername() setting new value: “Username4”
UserVO::setPwd() setting new value: “a87ff67”
AbstractValueObject::markNew()
DbExchange::addNew()
Marked As New: (UserVO) { Key: -1, user_id: -1, username: “Username4”, pwd: “a87ff67” }
UserVO::setUsername() setting new value: “Username5”
UserVO::setPwd() setting new value: “e4da3b7”
AbstractValueObject::markNew()
DbExchange::addNew()
Marked As New: (UserVO) { Key: -1, user_id: -1, username: “Username5”, pwd: “e4da3b7” }
UserVO::setUsername() setting new value: “Username6”
UserVO::setPwd() setting new value: “1679091”
AbstractValueObject::markNew()
DbExchange::addNew()
Marked As New: (UserVO) { Key: -1, user_id: -1, username: “Username6”, pwd: “1679091” }
UserVO::setUsername() setting new value: “Username7”
UserVO::setPwd() setting new value: “8f14e45”
AbstractValueObject::markNew()
DbExchange::addNew()
Marked As New: (UserVO) { Key: -1, user_id: -1, username: “Username7”, pwd: “8f14e45” }
UserVO::setUsername() setting new value: “Username8”
UserVO::setPwd() setting new value: “c9f0f89”
AbstractValueObject::markNew()
DbExchange::addNew()
Marked As New: (UserVO) { Key: -1, user_id: -1, username: “Username8”, pwd: “c9f0f89” }
UserVO::setUsername() setting new value: “Username9”
UserVO::setPwd() setting new value: “45c48cc”
AbstractValueObject::markNew()
DbExchange::addNew()
Marked As New: (UserVO) { Key: -1, user_id: -1, username: “Username9”, pwd: “45c48cc” }
Now we will look into the DbTest::Broker() and they should all be present and marked as new.
Line #418DbExchange::Summary
(2) Clean VOs:
Key 'UserVO.41918': (UserVO) { Key: 41918, user_id: 41918, username: “theUsername”, pwd: “thePwd” }
Key 'UserVO.41919': (UserVO) { Key: 41919, user_id: 41919, username: “Username12:56:52”, pwd: “462899” }
(10) New VOs:
Key '0': (UserVO) { Key: -1, user_id: -1, username: “Username0”, pwd: “cfcd208” }
Key '1': (UserVO) { Key: -1, user_id: -1, username: “Username1”, pwd: “c4ca423” }
Key '2': (UserVO) { Key: -1, user_id: -1, username: “Username2”, pwd: “c81e728” }
Key '3': (UserVO) { Key: -1, user_id: -1, username: “Username3”, pwd: “eccbc87” }
Key '4': (UserVO) { Key: -1, user_id: -1, username: “Username4”, pwd: “a87ff67” }
Key '5': (UserVO) { Key: -1, user_id: -1, username: “Username5”, pwd: “e4da3b7” }
Key '6': (UserVO) { Key: -1, user_id: -1, username: “Username6”, pwd: “1679091” }
Key '7': (UserVO) { Key: -1, user_id: -1, username: “Username7”, pwd: “8f14e45” }
Key '8': (UserVO) { Key: -1, user_id: -1, username: “Username8”, pwd: “c9f0f89” }
Key '9': (UserVO) { Key: -1, user_id: -1, username: “Username9”, pwd: “45c48cc” }
(1) Dirty VOs:
Key 'UserVO.2': (UserVO) { Key: 2, user_id: 2, username: “Method3User”, pwd: “Method3Pwd” }
(0) Deleted VOs: *Empty* (3) All VOs:
Key 'UserVO.41918': (UserVO) { Key: 41918, user_id: 41918, username: “theUsername”, pwd: “thePwd” }
Key 'UserVO.41919': (UserVO) { Key: 41919, user_id: 41919, username: “Username12:56:52”, pwd: “462899” }
Key 'UserVO.2': (UserVO) { Key: 2, user_id: 2, username: “Method3User”, pwd: “Method3Pwd” }
Now we will actually insert them into the database.
DbTest::Broker()->commitInserts();
Inserting (10) VO objects...
Removed New #1 : (UserVO) { Key: -1, user_id: -1, username: “Username0”, pwd: “cfcd208” }
UserDbMap::insertNow()
Inserting (UserVO) { Key: -1, user_id: -1, username: “Username0”, pwd: “cfcd208” } in `user`
UserDbMap::insertNow() Insert successful
Setting new user id...
UserVO::setUserId() setting new value: “41920”
DbExchange::addClean()
Added to aryAll: (UserVO) { Key: 41920, user_id: 41920, username: “Username0”, pwd: “cfcd208” }.
Added to aryClean: (UserVO) { Key: 41920, user_id: 41920, username: “Username0”, pwd: “cfcd208” }.
Trim aryDirty. Trim aryDeleted. Trimming aryDeleted and aryDirty
Marked As Clean: (UserVO) { Key: 41920, user_id: 41920, username: “Username0”, pwd: “cfcd208” }
Removed New #2 : (UserVO) { Key: -1, user_id: -1, username: “Username1”, pwd: “c4ca423” }
UserDbMap::insertNow()
Inserting (UserVO) { Key: -1, user_id: -1, username: “Username1”, pwd: “c4ca423” } in `user`
UserDbMap::insertNow() Insert successful
Setting new user id...
UserVO::setUserId() setting new value: “41921”
DbExchange::addClean()
Added to aryAll: (UserVO) { Key: 41921, user_id: 41921, username: “Username1”, pwd: “c4ca423” }.
Added to aryClean: (UserVO) { Key: 41921, user_id: 41921, username: “Username1”, pwd: “c4ca423” }.
Trim aryDirty. Trim aryDeleted. Trimming aryDeleted and aryDirty
Marked As Clean: (UserVO) { Key: 41921, user_id: 41921, username: “Username1”, pwd: “c4ca423” }
Removed New #3 : (UserVO) { Key: -1, user_id: -1, username: “Username2”, pwd: “c81e728” }
UserDbMap::insertNow()
Inserting (UserVO) { Key: -1, user_id: -1, username: “Username2”, pwd: “c81e728” } in `user`
UserDbMap::insertNow() Insert successful
Setting new user id...
UserVO::setUserId() setting new value: “41922”
DbExchange::addClean()
Added to aryAll: (UserVO) { Key: 41922, user_id: 41922, username: “Username2”, pwd: “c81e728” }.
Added to aryClean: (UserVO) { Key: 41922, user_id: 41922, username: “Username2”, pwd: “c81e728” }.
Trim aryDirty. Trim aryDeleted. Trimming aryDeleted and aryDirty
Marked As Clean: (UserVO) { Key: 41922, user_id: 41922, username: “Username2”, pwd: “c81e728” }
Removed New #4 : (UserVO) { Key: -1, user_id: -1, username: “Username3”, pwd: “eccbc87” }
UserDbMap::insertNow()
Inserting (UserVO) { Key: -1, user_id: -1, username: “Username3”, pwd: “eccbc87” } in `user`
UserDbMap::insertNow() Insert successful
Setting new user id...
UserVO::setUserId() setting new value: “41923”
DbExchange::addClean()
Added to aryAll: (UserVO) { Key: 41923, user_id: 41923, username: “Username3”, pwd: “eccbc87” }.
Added to aryClean: (UserVO) { Key: 41923, user_id: 41923, username: “Username3”, pwd: “eccbc87” }.
Trim aryDirty. Trim aryDeleted. Trimming aryDeleted and aryDirty
Marked As Clean: (UserVO) { Key: 41923, user_id: 41923, username: “Username3”, pwd: “eccbc87” }
Removed New #5 : (UserVO) { Key: -1, user_id: -1, username: “Username4”, pwd: “a87ff67” }
UserDbMap::insertNow()
Inserting (UserVO) { Key: -1, user_id: -1, username: “Username4”, pwd: “a87ff67” } in `user`
UserDbMap::insertNow() Insert successful
Setting new user id...
UserVO::setUserId() setting new value: “41924”
DbExchange::addClean()
Added to aryAll: (UserVO) { Key: 41924, user_id: 41924, username: “Username4”, pwd: “a87ff67” }.
Added to aryClean: (UserVO) { Key: 41924, user_id: 41924, username: “Username4”, pwd: “a87ff67” }.
Trim aryDirty. Trim aryDeleted. Trimming aryDeleted and aryDirty
Marked As Clean: (UserVO) { Key: 41924, user_id: 41924, username: “Username4”, pwd: “a87ff67” }
Removed New #6 : (UserVO) { Key: -1, user_id: -1, username: “Username5”, pwd: “e4da3b7” }
UserDbMap::insertNow()
Inserting (UserVO) { Key: -1, user_id: -1, username: “Username5”, pwd: “e4da3b7” } in `user`
UserDbMap::insertNow() Insert successful
Setting new user id...
UserVO::setUserId() setting new value: “41925”
DbExchange::addClean()
Added to aryAll: (UserVO) { Key: 41925, user_id: 41925, username: “Username5”, pwd: “e4da3b7” }.
Added to aryClean: (UserVO) { Key: 41925, user_id: 41925, username: “Username5”, pwd: “e4da3b7” }.
Trim aryDirty. Trim aryDeleted. Trimming aryDeleted and aryDirty
Marked As Clean: (UserVO) { Key: 41925, user_id: 41925, username: “Username5”, pwd: “e4da3b7” }
Removed New #7 : (UserVO) { Key: -1, user_id: -1, username: “Username6”, pwd: “1679091” }
UserDbMap::insertNow()
Inserting (UserVO) { Key: -1, user_id: -1, username: “Username6”, pwd: “1679091” } in `user`
UserDbMap::insertNow() Insert successful
Setting new user id...
UserVO::setUserId() setting new value: “41926”
DbExchange::addClean()
Added to aryAll: (UserVO) { Key: 41926, user_id: 41926, username: “Username6”, pwd: “1679091” }.
Added to aryClean: (UserVO) { Key: 41926, user_id: 41926, username: “Username6”, pwd: “1679091” }.
Trim aryDirty. Trim aryDeleted. Trimming aryDeleted and aryDirty
Marked As Clean: (UserVO) { Key: 41926, user_id: 41926, username: “Username6”, pwd: “1679091” }
Removed New #8 : (UserVO) { Key: -1, user_id: -1, username: “Username7”, pwd: “8f14e45” }
UserDbMap::insertNow()
Inserting (UserVO) { Key: -1, user_id: -1, username: “Username7”, pwd: “8f14e45” } in `user`
UserDbMap::insertNow() Insert successful
Setting new user id...
UserVO::setUserId() setting new value: “41927”
DbExchange::addClean()
Added to aryAll: (UserVO) { Key: 41927, user_id: 41927, username: “Username7”, pwd: “8f14e45” }.
Added to aryClean: (UserVO) { Key: 41927, user_id: 41927, username: “Username7”, pwd: “8f14e45” }.
Trim aryDirty. Trim aryDeleted. Trimming aryDeleted and aryDirty
Marked As Clean: (UserVO) { Key: 41927, user_id: 41927, username: “Username7”, pwd: “8f14e45” }
Removed New #9 : (UserVO) { Key: -1, user_id: -1, username: “Username8”, pwd: “c9f0f89” }
UserDbMap::insertNow()
Inserting (UserVO) { Key: -1, user_id: -1, username: “Username8”, pwd: “c9f0f89” } in `user`
UserDbMap::insertNow() Insert successful
Setting new user id...
UserVO::setUserId() setting new value: “41928”
DbExchange::addClean()
Added to aryAll: (UserVO) { Key: 41928, user_id: 41928, username: “Username8”, pwd: “c9f0f89” }.
Added to aryClean: (UserVO) { Key: 41928, user_id: 41928, username: “Username8”, pwd: “c9f0f89” }.
Trim aryDirty. Trim aryDeleted. Trimming aryDeleted and aryDirty
Marked As Clean: (UserVO) { Key: 41928, user_id: 41928, username: “Username8”, pwd: “c9f0f89” }
Removed New #10 : (UserVO) { Key: -1, user_id: -1, username: “Username9”, pwd: “45c48cc” }
UserDbMap::insertNow()
Inserting (UserVO) { Key: -1, user_id: -1, username: “Username9”, pwd: “45c48cc” } in `user`
UserDbMap::insertNow() Insert successful
Setting new user id...
UserVO::setUserId() setting new value: “41929”
DbExchange::addClean()
Added to aryAll: (UserVO) { Key: 41929, user_id: 41929, username: “Username9”, pwd: “45c48cc” }.
Added to aryClean: (UserVO) { Key: 41929, user_id: 41929, username: “Username9”, pwd: “45c48cc” }.
Trim aryDirty. Trim aryDeleted. Trimming aryDeleted and aryDirty
Marked As Clean: (UserVO) { Key: 41929, user_id: 41929, username: “Username9”, pwd: “45c48cc” }
Line #433DbExchange::Summary
(12) Clean VOs:
Key 'UserVO.41918': (UserVO) { Key: 41918, user_id: 41918, username: “theUsername”, pwd: “thePwd” }
Key 'UserVO.41919': (UserVO) { Key: 41919, user_id: 41919, username: “Username12:56:52”, pwd: “462899” }
Key 'UserVO.41920': (UserVO) { Key: 41920, user_id: 41920, username: “Username0”, pwd: “cfcd208” }
Key 'UserVO.41921': (UserVO) { Key: 41921, user_id: 41921, username: “Username1”, pwd: “c4ca423” }
Key 'UserVO.41922': (UserVO) { Key: 41922, user_id: 41922, username: “Username2”, pwd: “c81e728” }
Key 'UserVO.41923': (UserVO) { Key: 41923, user_id: 41923, username: “Username3”, pwd: “eccbc87” }
Key 'UserVO.41924': (UserVO) { Key: 41924, user_id: 41924, username: “Username4”, pwd: “a87ff67” }
Key 'UserVO.41925': (UserVO) { Key: 41925, user_id: 41925, username: “Username5”, pwd: “e4da3b7” }
Key 'UserVO.41926': (UserVO) { Key: 41926, user_id: 41926, username: “Username6”, pwd: “1679091” }
Key 'UserVO.41927': (UserVO) { Key: 41927, user_id: 41927, username: “Username7”, pwd: “8f14e45” }
Key 'UserVO.41928': (UserVO) { Key: 41928, user_id: 41928, username: “Username8”, pwd: “c9f0f89” }
Key 'UserVO.41929': (UserVO) { Key: 41929, user_id: 41929, username: “Username9”, pwd: “45c48cc” }
(0) New VOs: *Empty* (1) Dirty VOs:
Key 'UserVO.2': (UserVO) { Key: 2, user_id: 2, username: “Method3User”, pwd: “Method3Pwd” }
(0) Deleted VOs: *Empty* (13) All VOs:
Key 'UserVO.41918': (UserVO) { Key: 41918, user_id: 41918, username: “theUsername”, pwd: “thePwd” }
Key 'UserVO.41919': (UserVO) { Key: 41919, user_id: 41919, username: “Username12:56:52”, pwd: “462899” }
Key 'UserVO.2': (UserVO) { Key: 2, user_id: 2, username: “Method3User”, pwd: “Method3Pwd” }
Key 'UserVO.41920': (UserVO) { Key: 41920, user_id: 41920, username: “Username0”, pwd: “cfcd208” }
Key 'UserVO.41921': (UserVO) { Key: 41921, user_id: 41921, username: “Username1”, pwd: “c4ca423” }
Key 'UserVO.41922': (UserVO) { Key: 41922, user_id: 41922, username: “Username2”, pwd: “c81e728” }
Key 'UserVO.41923': (UserVO) { Key: 41923, user_id: 41923, username: “Username3”, pwd: “eccbc87” }
Key 'UserVO.41924': (UserVO) { Key: 41924, user_id: 41924, username: “Username4”, pwd: “a87ff67” }
Key 'UserVO.41925': (UserVO) { Key: 41925, user_id: 41925, username: “Username5”, pwd: “e4da3b7” }
Key 'UserVO.41926': (UserVO) { Key: 41926, user_id: 41926, username: “Username6”, pwd: “1679091” }
Key 'UserVO.41927': (UserVO) { Key: 41927, user_id: 41927, username: “Username7”, pwd: “8f14e45” }
Key 'UserVO.41928': (UserVO) { Key: 41928, user_id: 41928, username: “Username8”, pwd: “c9f0f89” }
Key 'UserVO.41929': (UserVO) { Key: 41929, user_id: 41929, username: “Username9”, pwd: “45c48cc” }
$newCollection = $userTableSelector->select()->userId(">",8)->orderBy("RAND()", "ASC")->limit(0,16)->fetch();
echo $newCollection;
AbstractSelector::fetch() using query: “SELECT * FROM `user` WHERE `user`.`user_id` > 8 ORDER BY RAND() ASC LIMIT 0, 16 ”
Collection:
AbstractCollection::__toString()
Raw VO Data (Total = 12):
Raw 0: Array
(
[user_id] => 41928
[username] => Username8
[pwd] => c9f0f89
)
Raw 1: Array
(
[user_id] => 41926
[username] => Username6
[pwd] => 1679091
)
Raw 2: Array
(
[user_id] => 41918
[username] => theUsername
[pwd] => thePwd
)
Raw 3: Array
(
[user_id] => 41922
[username] => Username2
[pwd] => c81e728
)
Raw 4: Array
(
[user_id] => 41923
[username] => Username3
[pwd] => eccbc87
)
Raw 5: Array
(
[user_id] => 41927
[username] => Username7
[pwd] => 8f14e45
)
Raw 6: Array
(
[user_id] => 41920
[username] => Username0
[pwd] => cfcd208
)
Raw 7: Array
(
[user_id] => 41919
[username] => Username12:56:52
[pwd] => 462899
)
Raw 8: Array
(
[user_id] => 41925
[username] => Username5
[pwd] => e4da3b7
)
Raw 9: Array
(
[user_id] => 41929
[username] => Username9
[pwd] => 45c48cc
)
Raw 10: Array
(
[user_id] => 41921
[username] => Username1
[pwd] => c4ca423
)
Raw 11: Array
(
[user_id] => 41924
[username] => Username4
[pwd] => a87ff67
)
Built UserVO Objects (Total = 0 of 12):
Now that we have our user rows we'll pick them out one at a time to delete.
$delete1User = $newCollection->current();
//Returns the object at the Iterator method's “current” position.
echo $delete1User;
AbstractCollection::getRow()
Building and returning UserVO #0
AbstractDbTableMap::getVO() delegating to concrete class....
UserDbMap::getInstance() Creating new UserVO and calling init()
UserVO::init() Setting Properties With: Array
(
[user_id] => 41928
[username] => Username8
[pwd] => c9f0f89
)
(UserVO) { Key: 41928, user_id: 41928, username: “Username8”, pwd: “c9f0f89” }
$delete2User = $newCollection->current();
$delete2User->markClean();
echo $delete2User;
AbstractCollection::getRow()
Returning already built UserVO #0
AbstractValueObject::markClean()
DbExchange::addClean()
Added to aryAll: (UserVO) { Key: 41928, user_id: 41928, username: “Username8”, pwd: “c9f0f89” }.
Added to aryClean: (UserVO) { Key: 41928, user_id: 41928, username: “Username8”, pwd: “c9f0f89” }.
Trim aryDirty. Trim aryDeleted. Trimming aryDeleted and aryDirty
Marked As Clean: (UserVO) { Key: 41928, user_id: 41928, username: “Username8”, pwd: “c9f0f89” }
(UserVO) { Key: 41928, user_id: 41928, username: “Username8”, pwd: “c9f0f89” }
Line #486DbExchange::Summary
(12) Clean VOs:
Key 'UserVO.41918': (UserVO) { Key: 41918, user_id: 41918, username: “theUsername”, pwd: “thePwd” }
Key 'UserVO.41919': (UserVO) { Key: 41919, user_id: 41919, username: “Username12:56:52”, pwd: “462899” }
Key 'UserVO.41920': (UserVO) { Key: 41920, user_id: 41920, username: “Username0”, pwd: “cfcd208” }
Key 'UserVO.41921': (UserVO) { Key: 41921, user_id: 41921, username: “Username1”, pwd: “c4ca423” }
Key 'UserVO.41922': (UserVO) { Key: 41922, user_id: 41922, username: “Username2”, pwd: “c81e728” }
Key 'UserVO.41923': (UserVO) { Key: 41923, user_id: 41923, username: “Username3”, pwd: “eccbc87” }
Key 'UserVO.41924': (UserVO) { Key: 41924, user_id: 41924, username: “Username4”, pwd: “a87ff67” }
Key 'UserVO.41925': (UserVO) { Key: 41925, user_id: 41925, username: “Username5”, pwd: “e4da3b7” }
Key 'UserVO.41926': (UserVO) { Key: 41926, user_id: 41926, username: “Username6”, pwd: “1679091” }
Key 'UserVO.41927': (UserVO) { Key: 41927, user_id: 41927, username: “Username7”, pwd: “8f14e45” }
Key 'UserVO.41928': (UserVO) { Key: 41928, user_id: 41928, username: “Username8”, pwd: “c9f0f89” }
Key 'UserVO.41929': (UserVO) { Key: 41929, user_id: 41929, username: “Username9”, pwd: “45c48cc” }
(0) New VOs: *Empty* (1) Dirty VOs:
Key 'UserVO.2': (UserVO) { Key: 2, user_id: 2, username: “Method3User”, pwd: “Method3Pwd” }
(0) Deleted VOs: *Empty* (13) All VOs:
Key 'UserVO.41918': (UserVO) { Key: 41918, user_id: 41918, username: “theUsername”, pwd: “thePwd” }
Key 'UserVO.41919': (UserVO) { Key: 41919, user_id: 41919, username: “Username12:56:52”, pwd: “462899” }
Key 'UserVO.2': (UserVO) { Key: 2, user_id: 2, username: “Method3User”, pwd: “Method3Pwd” }
Key 'UserVO.41920': (UserVO) { Key: 41920, user_id: 41920, username: “Username0”, pwd: “cfcd208” }
Key 'UserVO.41921': (UserVO) { Key: 41921, user_id: 41921, username: “Username1”, pwd: “c4ca423” }
Key 'UserVO.41922': (UserVO) { Key: 41922, user_id: 41922, username: “Username2”, pwd: “c81e728” }
Key 'UserVO.41923': (UserVO) { Key: 41923, user_id: 41923, username: “Username3”, pwd: “eccbc87” }
Key 'UserVO.41924': (UserVO) { Key: 41924, user_id: 41924, username: “Username4”, pwd: “a87ff67” }
Key 'UserVO.41925': (UserVO) { Key: 41925, user_id: 41925, username: “Username5”, pwd: “e4da3b7” }
Key 'UserVO.41926': (UserVO) { Key: 41926, user_id: 41926, username: “Username6”, pwd: “1679091” }
Key 'UserVO.41927': (UserVO) { Key: 41927, user_id: 41927, username: “Username7”, pwd: “8f14e45” }
Key 'UserVO.41928': (UserVO) { Key: 41928, user_id: 41928, username: “Username8”, pwd: “c9f0f89” }
Key 'UserVO.41929': (UserVO) { Key: 41929, user_id: 41929, username: “Username9”, pwd: “45c48cc” }
$delete1User->markDeleted();
$delete2User->markDeleted();
echo $newCollection;
AbstractValueObject::markDeleted()
DbExchange::addDeleted()
Added to aryDeleted: (UserVO) { Key: 41928, user_id: 41928, username: “Username8”, pwd: “c9f0f89” }.
Trimming aryNew, aryClean, and aryDirty
Marked As Deleted: (UserVO) { Key: 41928, user_id: 41928, username: “Username8”, pwd: “c9f0f89” }
AbstractValueObject::markDeleted()
DbExchange::addDeleted()
Trimming aryNew, aryClean, and aryDirty
Marked As Deleted: (UserVO) { Key: 41928, user_id: 41928, username: “Username8”, pwd: “c9f0f89” }
Line #515DbExchange::Summary
(11) Clean VOs:
Key 'UserVO.41918': (UserVO) { Key: 41918, user_id: 41918, username: “theUsername”, pwd: “thePwd” }
Key 'UserVO.41919': (UserVO) { Key: 41919, user_id: 41919, username: “Username12:56:52”, pwd: “462899” }
Key 'UserVO.41920': (UserVO) { Key: 41920, user_id: 41920, username: “Username0”, pwd: “cfcd208” }
Key 'UserVO.41921': (UserVO) { Key: 41921, user_id: 41921, username: “Username1”, pwd: “c4ca423” }
Key 'UserVO.41922': (UserVO) { Key: 41922, user_id: 41922, username: “Username2”, pwd: “c81e728” }
Key 'UserVO.41923': (UserVO) { Key: 41923, user_id: 41923, username: “Username3”, pwd: “eccbc87” }
Key 'UserVO.41924': (UserVO) { Key: 41924, user_id: 41924, username: “Username4”, pwd: “a87ff67” }
Key 'UserVO.41925': (UserVO) { Key: 41925, user_id: 41925, username: “Username5”, pwd: “e4da3b7” }
Key 'UserVO.41926': (UserVO) { Key: 41926, user_id: 41926, username: “Username6”, pwd: “1679091” }
Key 'UserVO.41927': (UserVO) { Key: 41927, user_id: 41927, username: “Username7”, pwd: “8f14e45” }
Key 'UserVO.41929': (UserVO) { Key: 41929, user_id: 41929, username: “Username9”, pwd: “45c48cc” }
(0) New VOs: *Empty* (1) Dirty VOs:
Key 'UserVO.2': (UserVO) { Key: 2, user_id: 2, username: “Method3User”, pwd: “Method3Pwd” }
(1) Deleted VOs:
Key 'UserVO.41928': (UserVO) { Key: 41928, user_id: 41928, username: “Username8”, pwd: “c9f0f89” }
(13) All VOs:
Key 'UserVO.41918': (UserVO) { Key: 41918, user_id: 41918, username: “theUsername”, pwd: “thePwd” }
Key 'UserVO.41919': (UserVO) { Key: 41919, user_id: 41919, username: “Username12:56:52”, pwd: “462899” }
Key 'UserVO.2': (UserVO) { Key: 2, user_id: 2, username: “Method3User”, pwd: “Method3Pwd” }
Key 'UserVO.41920': (UserVO) { Key: 41920, user_id: 41920, username: “Username0”, pwd: “cfcd208” }
Key 'UserVO.41921': (UserVO) { Key: 41921, user_id: 41921, username: “Username1”, pwd: “c4ca423” }
Key 'UserVO.41922': (UserVO) { Key: 41922, user_id: 41922, username: “Username2”, pwd: “c81e728” }
Key 'UserVO.41923': (UserVO) { Key: 41923, user_id: 41923, username: “Username3”, pwd: “eccbc87” }
Key 'UserVO.41924': (UserVO) { Key: 41924, user_id: 41924, username: “Username4”, pwd: “a87ff67” }
Key 'UserVO.41925': (UserVO) { Key: 41925, user_id: 41925, username: “Username5”, pwd: “e4da3b7” }
Key 'UserVO.41926': (UserVO) { Key: 41926, user_id: 41926, username: “Username6”, pwd: “1679091” }
Key 'UserVO.41927': (UserVO) { Key: 41927, user_id: 41927, username: “Username7”, pwd: “8f14e45” }
Key 'UserVO.41928': (UserVO) { Key: 41928, user_id: 41928, username: “Username8”, pwd: “c9f0f89” }
Key 'UserVO.41929': (UserVO) { Key: 41929, user_id: 41929, username: “Username9”, pwd: “45c48cc” }
$delete1User->markClean();
echo $delete1User;
AbstractValueObject::markClean()
DbExchange::addClean()
Added to aryClean: (UserVO) { Key: 41928, user_id: 41928, username: “Username8”, pwd: “c9f0f89” }.
Trim aryDirty. Trim aryDeleted. Trimming aryDeleted and aryDirty
Marked As Clean: (UserVO) { Key: 41928, user_id: 41928, username: “Username8”, pwd: “c9f0f89” }
(UserVO) { Key: 41928, user_id: 41928, username: “Username8”, pwd: “c9f0f89” }
Look into the DbTest::Broker() and it (Key: 41928)
should have been moved into the clean list.
Line #538DbExchange::Summary
(12) Clean VOs:
Key 'UserVO.41918': (UserVO) { Key: 41918, user_id: 41918, username: “theUsername”, pwd: “thePwd” }
Key 'UserVO.41919': (UserVO) { Key: 41919, user_id: 41919, username: “Username12:56:52”, pwd: “462899” }
Key 'UserVO.41920': (UserVO) { Key: 41920, user_id: 41920, username: “Username0”, pwd: “cfcd208” }
Key 'UserVO.41921': (UserVO) { Key: 41921, user_id: 41921, username: “Username1”, pwd: “c4ca423” }
Key 'UserVO.41922': (UserVO) { Key: 41922, user_id: 41922, username: “Username2”, pwd: “c81e728” }
Key 'UserVO.41923': (UserVO) { Key: 41923, user_id: 41923, username: “Username3”, pwd: “eccbc87” }
Key 'UserVO.41924': (UserVO) { Key: 41924, user_id: 41924, username: “Username4”, pwd: “a87ff67” }
Key 'UserVO.41925': (UserVO) { Key: 41925, user_id: 41925, username: “Username5”, pwd: “e4da3b7” }
Key 'UserVO.41926': (UserVO) { Key: 41926, user_id: 41926, username: “Username6”, pwd: “1679091” }
Key 'UserVO.41927': (UserVO) { Key: 41927, user_id: 41927, username: “Username7”, pwd: “8f14e45” }
Key 'UserVO.41929': (UserVO) { Key: 41929, user_id: 41929, username: “Username9”, pwd: “45c48cc” }
Key 'UserVO.41928': (UserVO) { Key: 41928, user_id: 41928, username: “Username8”, pwd: “c9f0f89” }
(0) New VOs: *Empty* (1) Dirty VOs:
Key 'UserVO.2': (UserVO) { Key: 2, user_id: 2, username: “Method3User”, pwd: “Method3Pwd” }
(0) Deleted VOs: *Empty* (13) All VOs:
Key 'UserVO.41918': (UserVO) { Key: 41918, user_id: 41918, username: “theUsername”, pwd: “thePwd” }
Key 'UserVO.41919': (UserVO) { Key: 41919, user_id: 41919, username: “Username12:56:52”, pwd: “462899” }
Key 'UserVO.2': (UserVO) { Key: 2, user_id: 2, username: “Method3User”, pwd: “Method3Pwd” }
Key 'UserVO.41920': (UserVO) { Key: 41920, user_id: 41920, username: “Username0”, pwd: “cfcd208” }
Key 'UserVO.41921': (UserVO) { Key: 41921, user_id: 41921, username: “Username1”, pwd: “c4ca423” }
Key 'UserVO.41922': (UserVO) { Key: 41922, user_id: 41922, username: “Username2”, pwd: “c81e728” }
Key 'UserVO.41923': (UserVO) { Key: 41923, user_id: 41923, username: “Username3”, pwd: “eccbc87” }
Key 'UserVO.41924': (UserVO) { Key: 41924, user_id: 41924, username: “Username4”, pwd: “a87ff67” }
Key 'UserVO.41925': (UserVO) { Key: 41925, user_id: 41925, username: “Username5”, pwd: “e4da3b7” }
Key 'UserVO.41926': (UserVO) { Key: 41926, user_id: 41926, username: “Username6”, pwd: “1679091” }
Key 'UserVO.41927': (UserVO) { Key: 41927, user_id: 41927, username: “Username7”, pwd: “8f14e45” }
Key 'UserVO.41928': (UserVO) { Key: 41928, user_id: 41928, username: “Username8”, pwd: “c9f0f89” }
Key 'UserVO.41929': (UserVO) { Key: 41929, user_id: 41929, username: “Username9”, pwd: “45c48cc” }
DbTest::Broker()->commitAll();
DbExchange::commitAll()...
Inserting (0) VO objects...
Updating (1) VO objects...
UserDbMap::updateNow() Updated: (UserVO) { Key: 2, user_id: 2, username: “Method3User”, pwd: “Method3Pwd” }
DbExchange::addClean()
Added to aryClean: (UserVO) { Key: 2, user_id: 2, username: “Method3User”, pwd: “Method3Pwd” }.
Trim aryDirty. Trim aryDeleted. Trimming aryDeleted and aryDirty
Marked As Clean: (UserVO) { Key: 2, user_id: 2, username: “Method3User”, pwd: “Method3Pwd” }
Deleting (0) VO objects...
Commited all database synchronizations.
Notice that all the DOs are now marked as “clean,”
including $delete1User (Key: 41928) which was re-marked clean before synchronizing
the DbTest::Broker() with the database and therefore not deleted.
Line #563DbExchange::Summary
(13) Clean VOs:
Key 'UserVO.41918': (UserVO) { Key: 41918, user_id: 41918, username: “theUsername”, pwd: “thePwd” }
Key 'UserVO.41919': (UserVO) { Key: 41919, user_id: 41919, username: “Username12:56:52”, pwd: “462899” }
Key 'UserVO.41920': (UserVO) { Key: 41920, user_id: 41920, username: “Username0”, pwd: “cfcd208” }
Key 'UserVO.41921': (UserVO) { Key: 41921, user_id: 41921, username: “Username1”, pwd: “c4ca423” }
Key 'UserVO.41922': (UserVO) { Key: 41922, user_id: 41922, username: “Username2”, pwd: “c81e728” }
Key 'UserVO.41923': (UserVO) { Key: 41923, user_id: 41923, username: “Username3”, pwd: “eccbc87” }
Key 'UserVO.41924': (UserVO) { Key: 41924, user_id: 41924, username: “Username4”, pwd: “a87ff67” }
Key 'UserVO.41925': (UserVO) { Key: 41925, user_id: 41925, username: “Username5”, pwd: “e4da3b7” }
Key 'UserVO.41926': (UserVO) { Key: 41926, user_id: 41926, username: “Username6”, pwd: “1679091” }
Key 'UserVO.41927': (UserVO) { Key: 41927, user_id: 41927, username: “Username7”, pwd: “8f14e45” }
Key 'UserVO.41929': (UserVO) { Key: 41929, user_id: 41929, username: “Username9”, pwd: “45c48cc” }
Key 'UserVO.41928': (UserVO) { Key: 41928, user_id: 41928, username: “Username8”, pwd: “c9f0f89” }
Key 'UserVO.2': (UserVO) { Key: 2, user_id: 2, username: “Method3User”, pwd: “Method3Pwd” }
(0) New VOs: *Empty* (0) Dirty VOs: *Empty* (0) Deleted VOs: *Empty* (13) All VOs:
Key 'UserVO.41918': (UserVO) { Key: 41918, user_id: 41918, username: “theUsername”, pwd: “thePwd” }
Key 'UserVO.41919': (UserVO) { Key: 41919, user_id: 41919, username: “Username12:56:52”, pwd: “462899” }
Key 'UserVO.2': (UserVO) { Key: 2, user_id: 2, username: “Method3User”, pwd: “Method3Pwd” }
Key 'UserVO.41920': (UserVO) { Key: 41920, user_id: 41920, username: “Username0”, pwd: “cfcd208” }
Key 'UserVO.41921': (UserVO) { Key: 41921, user_id: 41921, username: “Username1”, pwd: “c4ca423” }
Key 'UserVO.41922': (UserVO) { Key: 41922, user_id: 41922, username: “Username2”, pwd: “c81e728” }
Key 'UserVO.41923': (UserVO) { Key: 41923, user_id: 41923, username: “Username3”, pwd: “eccbc87” }
Key 'UserVO.41924': (UserVO) { Key: 41924, user_id: 41924, username: “Username4”, pwd: “a87ff67” }
Key 'UserVO.41925': (UserVO) { Key: 41925, user_id: 41925, username: “Username5”, pwd: “e4da3b7” }
Key 'UserVO.41926': (UserVO) { Key: 41926, user_id: 41926, username: “Username6”, pwd: “1679091” }
Key 'UserVO.41927': (UserVO) { Key: 41927, user_id: 41927, username: “Username7”, pwd: “8f14e45” }
Key 'UserVO.41928': (UserVO) { Key: 41928, user_id: 41928, username: “Username8”, pwd: “c9f0f89” }
Key 'UserVO.41929': (UserVO) { Key: 41929, user_id: 41929, username: “Username9”, pwd: “45c48cc” }
Now we will empty the DbTest::Broker() so we can follow the contents better.
DbTest::Broker()->removeAll();
echo "Line #" . __LINE__ . DbTest::Broker();
DbExchange::removeAll Removing all object references.
Line #572DbExchange::Summary
(0) Clean VOs: *Empty* (0) New VOs: *Empty* (0) Dirty VOs: *Empty* (0) Deleted VOs: *Empty* (0) All VOs: *Empty*
echo $newCollection;
AbstractCollection::__toString()
Raw VO Data (Total = 12):
Raw 0: Array
(
[user_id] => 41928
[username] => Username8
[pwd] => c9f0f89
)
Raw 1: Array
(
[user_id] => 41926
[username] => Username6
[pwd] => 1679091
)
Raw 2: Array
(
[user_id] => 41918
[username] => theUsername
[pwd] => thePwd
)
Raw 3: Array
(
[user_id] => 41922
[username] => Username2
[pwd] => c81e728
)
Raw 4: Array
(
[user_id] => 41923
[username] => Username3
[pwd] => eccbc87
)
Raw 5: Array
(
[user_id] => 41927
[username] => Username7
[pwd] => 8f14e45
)
Raw 6: Array
(
[user_id] => 41920
[username] => Username0
[pwd] => cfcd208
)
Raw 7: Array
(
[user_id] => 41919
[username] => Username12:56:52
[pwd] => 462899
)
Raw 8: Array
(
[user_id] => 41925
[username] => Username5
[pwd] => e4da3b7
)
Raw 9: Array
(
[user_id] => 41929
[username] => Username9
[pwd] => 45c48cc
)
Raw 10: Array
(
[user_id] => 41921
[username] => Username1
[pwd] => c4ca423
)
Raw 11: Array
(
[user_id] => 41924
[username] => Username4
[pwd] => a87ff67
)
Built UserVO Objects (Total = 1 of 12):
VO 0: (UserVO) { Key: 41928, user_id: 41928, username: “Username8”, pwd: “c9f0f89” }
echo "Line #" . __LINE__;
$deletedUserReference = $newCollection->pop(1);//Remove & return the second item (index #1).
echo $deletedUserReference;
Line #609
AbstractCollection::pop() getting index: 1 of {0 - 11}
AbstractCollection::getRow()
Building and returning UserVO #1
AbstractDbTableMap::getVO() delegating to concrete class....
UserDbMap::getInstance() Creating new UserVO and calling init()
UserVO::init() Setting Properties With: Array
(
[user_id] => 41926
[username] => Username6
[pwd] => 1679091
)
AbstractCollection::pop() Unsetting (UserVO) { Key: 41926, user_id: 41926, username: “Username6”, pwd: “1679091” }
Removing the object at index #1 from the collection.
New Collection Total: 11
(UserVO) { Key: 41926, user_id: 41926, username: “Username6”, pwd: “1679091” }
unset ($deletedUserReference);
echo $deletedUserReference;
echo $newCollection;
AbstractCollection::__toString()
Raw VO Data (Total = 11):
Raw 0: Array
(
[user_id] => 41928
[username] => Username8
[pwd] => c9f0f89
)
Raw 1: Array
(
[user_id] => 41918
[username] => theUsername
[pwd] => thePwd
)
Raw 2: Array
(
[user_id] => 41922
[username] => Username2
[pwd] => c81e728
)
Raw 3: Array
(
[user_id] => 41923
[username] => Username3
[pwd] => eccbc87
)
Raw 4: Array
(
[user_id] => 41927
[username] => Username7
[pwd] => 8f14e45
)
Raw 5: Array
(
[user_id] => 41920
[username] => Username0
[pwd] => cfcd208
)
Raw 6: Array
(
[user_id] => 41919
[username] => Username12:56:52
[pwd] => 462899
)
Raw 7: Array
(
[user_id] => 41925
[username] => Username5
[pwd] => e4da3b7
)
Raw 8: Array
(
[user_id] => 41929
[username] => Username9
[pwd] => 45c48cc
)
Raw 9: Array
(
[user_id] => 41921
[username] => Username1
[pwd] => c4ca423
)
Raw 10: Array
(
[user_id] => 41924
[username] => Username4
[pwd] => a87ff67
)
Built UserVO Objects (Total = 1 of 11):
VO 0: (UserVO) { Key: 41928, user_id: 41928, username: “Username8”, pwd: “c9f0f89” }
$firstObject = $newCollection->shift();//Get and remove the *first* item from the collection.
echo "<hr />First: $firstObject";
AbstractCollection::getRow()
Returning already built UserVO #0
Removing the object at index #0 from the collection.
New Collection Total: 10
AbstractCollection::shift()
Returning: (UserVO) { Key: 41928, user_id: 41928, username: “Username8”, pwd: “c9f0f89” }
First: (UserVO) { Key: 41928, user_id: 41928, username: “Username8”, pwd: “c9f0f89” }
echo $newCollection;
AbstractCollection::__toString()
Raw VO Data (Total = 10):
Raw 0: Array
(
[user_id] => 41918
[username] => theUsername
[pwd] => thePwd
)
Raw 1: Array
(
[user_id] => 41922
[username] => Username2
[pwd] => c81e728
)
Raw 2: Array
(
[user_id] => 41923
[username] => Username3
[pwd] => eccbc87
)
Raw 3: Array
(
[user_id] => 41927
[username] => Username7
[pwd] => 8f14e45
)
Raw 4: Array
(
[user_id] => 41920
[username] => Username0
[pwd] => cfcd208
)
Raw 5: Array
(
[user_id] => 41919
[username] => Username12:56:52
[pwd] => 462899
)
Raw 6: Array
(
[user_id] => 41925
[username] => Username5
[pwd] => e4da3b7
)
Raw 7: Array
(
[user_id] => 41929
[username] => Username9
[pwd] => 45c48cc
)
Raw 8: Array
(
[user_id] => 41921
[username] => Username1
[pwd] => c4ca423
)
Raw 9: Array
(
[user_id] => 41924
[username] => Username4
[pwd] => a87ff67
)
Built UserVO Objects (Total = 0 of 10):
$lastObject = $newCollection->pop();//Remove the *last* item from the collection.
echo "<hr />Last: $lastObject";//Remember Collections are zero indexed (so the 14th object is #13)
AbstractCollection::pop() getting index: 9 of {0 - 9}
AbstractCollection::getRow()
Building and returning UserVO #9
AbstractDbTableMap::getVO() delegating to concrete class....
UserDbMap::getInstance() Creating new UserVO and calling init()
UserVO::init() Setting Properties With: Array
(
[user_id] => 41924
[username] => Username4
[pwd] => a87ff67
)
AbstractCollection::pop() Unsetting (UserVO) { Key: 41924, user_id: 41924, username: “Username4”, pwd: “a87ff67” }
Removing the object at index #9 from the collection.
New Collection Total: 9
Last: (UserVO) { Key: 41924, user_id: 41924, username: “Username4”, pwd: “a87ff67” }
Line: 656
echo $newCollection;
AbstractCollection::__toString()
Raw VO Data (Total = 9):
Raw 0: Array
(
[user_id] => 41918
[username] => theUsername
[pwd] => thePwd
)
Raw 1: Array
(
[user_id] => 41922
[username] => Username2
[pwd] => c81e728
)
Raw 2: Array
(
[user_id] => 41923
[username] => Username3
[pwd] => eccbc87
)
Raw 3: Array
(
[user_id] => 41927
[username] => Username7
[pwd] => 8f14e45
)
Raw 4: Array
(
[user_id] => 41920
[username] => Username0
[pwd] => cfcd208
)
Raw 5: Array
(
[user_id] => 41919
[username] => Username12:56:52
[pwd] => 462899
)
Raw 6: Array
(
[user_id] => 41925
[username] => Username5
[pwd] => e4da3b7
)
Raw 7: Array
(
[user_id] => 41929
[username] => Username9
[pwd] => 45c48cc
)
Raw 8: Array
(
[user_id] => 41921
[username] => Username1
[pwd] => c4ca423
)
Built UserVO Objects (Total = 0 of 9):
We can get a random object using random() which returns one object by default.
$randomVO = $newCollection->random();//Get a random object from the collection.
echo "Random: $random";
AbstractCollection::getRow()
Building and returning UserVO #3
AbstractDbTableMap::getVO() delegating to concrete class....
UserDbMap::getInstance() Creating new UserVO and calling init()
UserVO::init() Setting Properties With: Array
(
[user_id] => 41927
[username] => Username7
[pwd] => 8f14e45
)
Random: (UserVO) { Key: 41927, user_id: 41927, username: “Username7”, pwd: “8f14e45” }
$randomCollection = $newCollection->random(4);
echo "<hr/>Random Collection: $randomCollection";
unset($randomCollection);
AbstractCollection::getRow()
Building and returning UserVO #1
AbstractDbTableMap::getVO() delegating to concrete class....
UserDbMap::getInstance() Creating new UserVO and calling init()
UserVO::init() Setting Properties With: Array
(
[user_id] => 41922
[username] => Username2
[pwd] => c81e728
)
AbstractCollection::push() adding UserVO.41922 to the collection
AbstractValueObject::toArray() converting (UserVO) { Key: 41922, user_id: 41922, username: “Username2”, pwd: “c81e728” } to an associative array...
UserDbMap::voToArray() converting UserVO.41922 back to an associative array
AbstractCollection::getRow()
Returning already built UserVO #3
AbstractCollection::push() adding UserVO.41927 to the collection
AbstractValueObject::toArray() converting (UserVO) { Key: 41927, user_id: 41927, username: “Username7”, pwd: “8f14e45” } to an associative array...
UserDbMap::voToArray() converting UserVO.41927 back to an associative array
AbstractCollection::getRow()
Building and returning UserVO #6
AbstractDbTableMap::getVO() delegating to concrete class....
UserDbMap::getInstance() Creating new UserVO and calling init()
UserVO::init() Setting Properties With: Array
(
[user_id] => 41925
[username] => Username5
[pwd] => e4da3b7
)
AbstractCollection::push() adding UserVO.41925 to the collection
AbstractValueObject::toArray() converting (UserVO) { Key: 41925, user_id: 41925, username: “Username5”, pwd: “e4da3b7” } to an associative array...
UserDbMap::voToArray() converting UserVO.41925 back to an associative array
AbstractCollection::getRow()
Building and returning UserVO #8
AbstractDbTableMap::getVO() delegating to concrete class....
UserDbMap::getInstance() Creating new UserVO and calling init()
UserVO::init() Setting Properties With: Array
(
[user_id] => 41921
[username] => Username1
[pwd] => c4ca423
)
AbstractCollection::push() adding UserVO.41921 to the collection
AbstractValueObject::toArray() converting (UserVO) { Key: 41921, user_id: 41921, username: “Username1”, pwd: “c4ca423” } to an associative array...
UserDbMap::voToArray() converting UserVO.41921 back to an associative array
Random Collection: AbstractCollection::__toString()
Raw VO Data (Total = 4):
Raw 0: Array
(
[user_id] => 41922
[username] => Username2
[pwd] => c81e728
)
Raw 1: Array
(
[user_id] => 41927
[username] => Username7
[pwd] => 8f14e45
)
Raw 2: Array
(
[user_id] => 41925
[username] => Username5
[pwd] => e4da3b7
)
Raw 3: Array
(
[user_id] => 41921
[username] => Username1
[pwd] => c4ca423
)
Built UserVO Objects (Total = 4 of 4):
VO 0: (UserVO) { Key: 41922, user_id: 41922, username: “Username2”, pwd: “c81e728” }
VO 1: (UserVO) { Key: 41927, user_id: 41927, username: “Username7”, pwd: “8f14e45” }
VO 2: (UserVO) { Key: 41925, user_id: 41925, username: “Username5”, pwd: “e4da3b7” }
VO 3: (UserVO) { Key: 41921, user_id: 41921, username: “Username1”, pwd: “c4ca423” }
We can simply remove an item by calling remove($idx).
echo "<hr/>Item we will remove at index #1: " . $newCollection->getRow(1) . "<hr/>";
$nothingReturned = $newCollection->remove(1);//Remove the second item (at index 1)
echo "$nothingReturned is null?: " . is_null($nothingReturned);
echo $newCollection;
AbstractCollection::getRow()
Returning already built UserVO #1
Item we will remove at index #1: (UserVO) { Key: 41922, user_id: 41922, username: “Username2”, pwd: “c81e728” }
Removing the object at index #1 from the collection.
New Collection Total: 8
$nothingReturned is null?: 1AbstractCollection::__toString()
Raw VO Data (Total = 8):
Raw 0: Array
(
[user_id] => 41918
[username] => theUsername
[pwd] => thePwd
)
Raw 1: Array
(
[user_id] => 41923
[username] => Username3
[pwd] => eccbc87
)
Raw 2: Array
(
[user_id] => 41927
[username] => Username7
[pwd] => 8f14e45
)
Raw 3: Array
(
[user_id] => 41920
[username] => Username0
[pwd] => cfcd208
)
Raw 4: Array
(
[user_id] => 41919
[username] => Username12:56:52
[pwd] => 462899
)
Raw 5: Array
(
[user_id] => 41925
[username] => Username5
[pwd] => e4da3b7
)
Raw 6: Array
(
[user_id] => 41929
[username] => Username9
[pwd] => 45c48cc
)
Raw 7: Array
(
[user_id] => 41921
[username] => Username1
[pwd] => c4ca423
)
Built UserVO Objects (Total = 3 of 8):
VO 0: (UserVO) { Key: 41927, user_id: 41927, username: “Username7”, pwd: “8f14e45” }
VO 1: (UserVO) { Key: 41925, user_id: 41925, username: “Username5”, pwd: “e4da3b7” }
VO 2: (UserVO) { Key: 41921, user_id: 41921, username: “Username1”, pwd: “c4ca423” }
Line #711
foreach ($newCollection as $vo){
/* @var $vo UserVO */
echo "<hr/>Index: #$idx<br/>";
$vo->markDeleted();
echo "<hr/>";
}
AbstractCollection::valid() validating #0 (Result: 1)
AbstractCollection::getRow()
Returning already built UserVO #0
Index: #0
AbstractValueObject::markDeleted()
DbExchange::addDeleted()
Added to aryAll: (UserVO) { Key: 41927, user_id: 41927, username: “Username7”, pwd: “8f14e45” }.
Added to aryDeleted: (UserVO) { Key: 41927, user_id: 41927, username: “Username7”, pwd: “8f14e45” }.
Trimming aryNew, aryClean, and aryDirty
Marked As Deleted: (UserVO) { Key: 41927, user_id: 41927, username: “Username7”, pwd: “8f14e45” }
AbstractCollection::valid() validating #1 (Result: 1)
AbstractCollection::getRow()
Returning already built UserVO #1
Index: #1
AbstractValueObject::markDeleted()
DbExchange::addDeleted()
Added to aryAll: (UserVO) { Key: 41925, user_id: 41925, username: “Username5”, pwd: “e4da3b7” }.
Added to aryDeleted: (UserVO) { Key: 41925, user_id: 41925, username: “Username5”, pwd: “e4da3b7” }.
Trimming aryNew, aryClean, and aryDirty
Marked As Deleted: (UserVO) { Key: 41925, user_id: 41925, username: “Username5”, pwd: “e4da3b7” }
AbstractCollection::valid() validating #2 (Result: 1)
AbstractCollection::getRow()
Returning already built UserVO #2
Index: #2
AbstractValueObject::markDeleted()
DbExchange::addDeleted()
Added to aryAll: (UserVO) { Key: 41921, user_id: 41921, username: “Username1”, pwd: “c4ca423” }.
Added to aryDeleted: (UserVO) { Key: 41921, user_id: 41921, username: “Username1”, pwd: “c4ca423” }.
Trimming aryNew, aryClean, and aryDirty
Marked As Deleted: (UserVO) { Key: 41921, user_id: 41921, username: “Username1”, pwd: “c4ca423” }
AbstractCollection::valid() validating #3 (Result: 1)
AbstractCollection::getRow()
Building and returning UserVO #3
AbstractDbTableMap::getVO() delegating to concrete class....
UserDbMap::getInstance() Creating new UserVO and calling init()
UserVO::init() Setting Properties With: Array
(
[user_id] => 41920
[username] => Username0
[pwd] => cfcd208
)
Index: #3
AbstractValueObject::markDeleted()
DbExchange::addDeleted()
Added to aryAll: (UserVO) { Key: 41920, user_id: 41920, username: “Username0”, pwd: “cfcd208” }.
Added to aryDeleted: (UserVO) { Key: 41920, user_id: 41920, username: “Username0”, pwd: “cfcd208” }.
Trimming aryNew, aryClean, and aryDirty
Marked As Deleted: (UserVO) { Key: 41920, user_id: 41920, username: “Username0”, pwd: “cfcd208” }
AbstractCollection::valid() validating #4 (Result: 1)
AbstractCollection::getRow()
Building and returning UserVO #4
AbstractDbTableMap::getVO() delegating to concrete class....
UserDbMap::getInstance() Creating new UserVO and calling init()
UserVO::init() Setting Properties With: Array
(
[user_id] => 41919
[username] => Username12:56:52
[pwd] => 462899
)
Index: #4
AbstractValueObject::markDeleted()
DbExchange::addDeleted()
Added to aryAll: (UserVO) { Key: 41919, user_id: 41919, username: “Username12:56:52”, pwd: “462899” }.
Added to aryDeleted: (UserVO) { Key: 41919, user_id: 41919, username: “Username12:56:52”, pwd: “462899” }.
Trimming aryNew, aryClean, and aryDirty
Marked As Deleted: (UserVO) { Key: 41919, user_id: 41919, username: “Username12:56:52”, pwd: “462899” }
AbstractCollection::valid() validating #5 (Result: 1)
AbstractCollection::getRow()
Building and returning UserVO #5
AbstractDbTableMap::getVO() delegating to concrete class....
UserDbMap::getInstance() Creating new UserVO and calling init()
UserVO::init() Setting Properties With: Array
(
[user_id] => 41925
[username] => Username5
[pwd] => e4da3b7
)
Index: #5
AbstractValueObject::markDeleted()
DbExchange::addDeleted()
Added to aryAll: (UserVO) { Key: 41925, user_id: 41925, username: “Username5”, pwd: “e4da3b7” }.
Added to aryDeleted: (UserVO) { Key: 41925, user_id: 41925, username: “Username5”, pwd: “e4da3b7” }.
Trimming aryNew, aryClean, and aryDirty
Marked As Deleted: (UserVO) { Key: 41925, user_id: 41925, username: “Username5”, pwd: “e4da3b7” }
AbstractCollection::valid() validating #6 (Result: 1)
AbstractCollection::getRow()
Building and returning UserVO #6
AbstractDbTableMap::getVO() delegating to concrete class....
UserDbMap::getInstance() Creating new UserVO and calling init()
UserVO::init() Setting Properties With: Array
(
[user_id] => 41929
[username] => Username9
[pwd] => 45c48cc
)
Index: #6
AbstractValueObject::markDeleted()
DbExchange::addDeleted()
Added to aryAll: (UserVO) { Key: 41929, user_id: 41929, username: “Username9”, pwd: “45c48cc” }.
Added to aryDeleted: (UserVO) { Key: 41929, user_id: 41929, username: “Username9”, pwd: “45c48cc” }.
Trimming aryNew, aryClean, and aryDirty
Marked As Deleted: (UserVO) { Key: 41929, user_id: 41929, username: “Username9”, pwd: “45c48cc” }
AbstractCollection::valid() validating #7 (Result: 1)
AbstractCollection::getRow()
Building and returning UserVO #7
AbstractDbTableMap::getVO() delegating to concrete class....
UserDbMap::getInstance() Creating new UserVO and calling init()
UserVO::init() Setting Properties With: Array
(
[user_id] => 41921
[username] => Username1
[pwd] => c4ca423
)
Index: #7
AbstractValueObject::markDeleted()
DbExchange::addDeleted()
Added to aryAll: (UserVO) { Key: 41921, user_id: 41921, username: “Username1”, pwd: “c4ca423” }.
Added to aryDeleted: (UserVO) { Key: 41921, user_id: 41921, username: “Username1”, pwd: “c4ca423” }.
Trimming aryNew, aryClean, and aryDirty
Marked As Deleted: (UserVO) { Key: 41921, user_id: 41921, username: “Username1”, pwd: “c4ca423” }
AbstractCollection::valid() validating #8 (Result: )
We can see that all the objects have been marked for deletion in the DbTest::Broker()
echo "Line #" . __LINE__;
echo DbTest::Broker();
Line #742DbExchange::Summary
(0) Clean VOs: *Empty* (0) New VOs: *Empty* (0) Dirty VOs: *Empty* (6) Deleted VOs:
Key 'UserVO.41927': (UserVO) { Key: 41927, user_id: 41927, username: “Username7”, pwd: “8f14e45” }
Key 'UserVO.41925': (UserVO) { Key: 41925, user_id: 41925, username: “Username5”, pwd: “e4da3b7” }
Key 'UserVO.41921': (UserVO) { Key: 41921, user_id: 41921, username: “Username1”, pwd: “c4ca423” }
Key 'UserVO.41920': (UserVO) { Key: 41920, user_id: 41920, username: “Username0”, pwd: “cfcd208” }
Key 'UserVO.41919': (UserVO) { Key: 41919, user_id: 41919, username: “Username12:56:52”, pwd: “462899” }
Key 'UserVO.41929': (UserVO) { Key: 41929, user_id: 41929, username: “Username9”, pwd: “45c48cc” }
(6) All VOs:
Key 'UserVO.41927': (UserVO) { Key: 41927, user_id: 41927, username: “Username7”, pwd: “8f14e45” }
Key 'UserVO.41925': (UserVO) { Key: 41925, user_id: 41925, username: “Username5”, pwd: “e4da3b7” }
Key 'UserVO.41921': (UserVO) { Key: 41921, user_id: 41921, username: “Username1”, pwd: “c4ca423” }
Key 'UserVO.41920': (UserVO) { Key: 41920, user_id: 41920, username: “Username0”, pwd: “cfcd208” }
Key 'UserVO.41919': (UserVO) { Key: 41919, user_id: 41919, username: “Username12:56:52”, pwd: “462899” }
Key 'UserVO.41929': (UserVO) { Key: 41929, user_id: 41929, username: “Username9”, pwd: “45c48cc” }
Now we'll synchronize ONLY the deletes with the database
echo "Line #" . __LINE__;
DbTest::Broker()->commitDeletes();
Line #755
Deleting (6) VO objects...
UserDbMap::deleteNow() Deleted: (UserVO) { Key: 41927, user_id: 41927, username: “Username7”, pwd: “8f14e45” }
Trim aryAll & aryDeleted
UserDbMap::deleteNow() Deleted: (UserVO) { Key: 41925, user_id: 41925, username: “Username5”, pwd: “e4da3b7” }
Trim aryAll & aryDeleted
UserDbMap::deleteNow() Deleted: (UserVO) { Key: 41921, user_id: 41921, username: “Username1”, pwd: “c4ca423” }
Trim aryAll & aryDeleted
UserDbMap::deleteNow() Deleted: (UserVO) { Key: 41920, user_id: 41920, username: “Username0”, pwd: “cfcd208” }
Trim aryAll & aryDeleted
UserDbMap::deleteNow() Deleted: (UserVO) { Key: 41919, user_id: 41919, username: “Username12:56:52”, pwd: “462899” }
Trim aryAll & aryDeleted
UserDbMap::deleteNow() Deleted: (UserVO) { Key: 41929, user_id: 41929, username: “Username9”, pwd: “45c48cc” }
Trim aryAll & aryDeleted
Now we see that the references are removed from the DbTest::Broker().
echo DbTest::Broker();
DbExchange::Summary
(0) Clean VOs: *Empty* (0) New VOs: *Empty* (0) Dirty VOs: *Empty* (0) Deleted VOs: *Empty* (0) All VOs: *Empty*
The references are still in the collection though...
echo $newCollection;
AbstractCollection::__toString()
Raw VO Data (Total = 8):
Raw 0: Array
(
[user_id] => 41918
[username] => theUsername
[pwd] => thePwd
)
Raw 1: Array
(
[user_id] => 41923
[username] => Username3
[pwd] => eccbc87
)
Raw 2: Array
(
[user_id] => 41927
[username] => Username7
[pwd] => 8f14e45
)
Raw 3: Array
(
[user_id] => 41920
[username] => Username0
[pwd] => cfcd208
)
Raw 4: Array
(
[user_id] => 41919
[username] => Username12:56:52
[pwd] => 462899
)
Raw 5: Array
(
[user_id] => 41925
[username] => Username5
[pwd] => e4da3b7
)
Raw 6: Array
(
[user_id] => 41929
[username] => Username9
[pwd] => 45c48cc
)
Raw 7: Array
(
[user_id] => 41921
[username] => Username1
[pwd] => c4ca423
)
Built UserVO Objects (Total = 8 of 8):
VO 0: (UserVO) { Key: 41927, user_id: 41927, username: “Username7”, pwd: “8f14e45” }
VO 1: (UserVO) { Key: 41925, user_id: 41925, username: “Username5”, pwd: “e4da3b7” }
VO 2: (UserVO) { Key: 41921, user_id: 41921, username: “Username1”, pwd: “c4ca423” }
VO 3: (UserVO) { Key: 41920, user_id: 41920, username: “Username0”, pwd: “cfcd208” }
VO 4: (UserVO) { Key: 41919, user_id: 41919, username: “Username12:56:52”, pwd: “462899” }
VO 5: (UserVO) { Key: 41925, user_id: 41925, username: “Username5”, pwd: “e4da3b7” }
VO 6: (UserVO) { Key: 41929, user_id: 41929, username: “Username9”, pwd: “45c48cc” }
VO 7: (UserVO) { Key: 41921, user_id: 41921, username: “Username1”, pwd: “c4ca423” }
So we'll delete the collection to remove the collection and instances from memory.
unset ($newCollection);
echo $newCollection;
Now the collection and all VO references are gone.
echo DbTest::Broker();
DbExchange::Summary
(0) Clean VOs: *Empty* (0) New VOs: *Empty* (0) Dirty VOs: *Empty* (0) Deleted VOs: *Empty* (0) All VOs: *Empty*