-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.php
33 lines (26 loc) · 1.27 KB
/
test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
require dirname(__FILE__).'/conf/config.auto.inc.php';
try {
$getAll = function () {
IngAdmin::dao()->dropIdentityMap();
IngProduct::dao()->dropIdentityMap();
return array(
IngAdmin::dao()->getById(1),
IngProduct::dao()->getById(1),
);
};
list($admin, $product) = $getAll();
var_dump('count: '.count($admin->getFavoriteProducts()->fetch()->getList()));
var_dump('count: '.count(Criteria::create(IngAdmin::dao())->add(Expression::eq('favoriteProducts.id', '1'))->getList()));
$admin->getFavoriteProducts()->fetch()->setList(array($product))->save();
list($admin, $product) = $getAll();
var_dump('count: '.count($admin->getFavoriteProducts()->fetch()->getList()));
var_dump('count: '.count(Criteria::create(IngAdmin::dao())->add(Expression::eq('favoriteProducts.id', '1'))->getList()));
$admin->getFavoriteProducts()->fetch()->setList(array())->save();
list($admin, $product) = $getAll();
var_dump('count: '.count($admin->getFavoriteProducts()->fetch()->getList()));
var_dump('count: '.count(Criteria::create(IngAdmin::dao())->add(Expression::eq('favoriteProducts.id', '1'))->getList()));
print "finished success\n";
} catch (Exception $e) {
var_dump(get_class($e), $e->getMessage(), $e->getCode(), $e->getFile(), $e->getLine(), $e->getTraceAsString());
}