-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.php
67 lines (45 loc) · 1.54 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
require 'vendor/autoload.php';
/*
* @todo:
* This should be auto-magically handled at the very least.
* Best case scenario is place model files in namespaces to
* use composer. However, that comes with several complications currently.
*/
Druid\Storage\ActiveRecord::loadModelFiles();
//loadProduct();
testCompositeKey();
function testCompositeKey() {
$items = BedCatalogProductWebsite::one([':id'=>['product_id'=>35,'website_id'=>1]]);
$items->each(function() {
echo "product: {$this->product_id} | website: {$this->website_id}".PHP_EOL;
});
}
function loadProduct() {
$configurables = BedCatalogProductEntity::all(['type_id'=> 'configurable', 'limit'=> 5]);
$configurables->each(function() {
$name = '';
$this->bed_catalog_product_entity_varchars->each(function() use (&$name) {
if($this->bed_eav_attribute->attribute_code == 'name' && $this->bed_core_store->store_id == 0) {
$name = $this->value;
return false;
}
});
echo $name.PHP_EOL;
// Load child products.
$children = BedCatalogProductEntity::all(
['include'=> 'bed_catalog_product_super_links' ],
['parent_id'=> $this->entity_id, 'require'=> true ]
);
$children->each(function() {
$name = '';
$this->bed_catalog_product_entity_varchars->each(function() use (&$name) {
if($this->bed_eav_attribute->attribute_code == 'name' && $this->bed_core_store->store_id == 0) {
$name = $this->value;
return false;
}
});
echo $name.PHP_EOL;
});
});
}