|
@@ 1032-1049 (lines=18) @@
|
| 1029 |
|
* |
| 1030 |
|
* @return string The ID of the persisted entity |
| 1031 |
|
*/ |
| 1032 |
|
public function persistProduct($product, $name = null) |
| 1033 |
|
{ |
| 1034 |
|
|
| 1035 |
|
// persist the new entity and set the PK value in the entity |
| 1036 |
|
$product[$pkName = $this->getProductRepository()->getPrimaryKeyName()] = $this->getProductAction()->persist($product, $name); |
| 1037 |
|
|
| 1038 |
|
// load the cache adapter instance |
| 1039 |
|
$cacheAdapter = $this->getProductRepository()->getCacheAdapter(); |
| 1040 |
|
|
| 1041 |
|
// we only want to replace existing values, NOT adding new ones as this is the responsibility of the repository |
| 1042 |
|
if ($cacheAdapter->isCached($uniqueKey = array(CacheKeys::PRODUCT => $product[$pkName]))) { |
| 1043 |
|
// add the entity value to the cache, register the cache key reference as well |
| 1044 |
|
$cacheAdapter->toCache($uniqueKey, $product, array(), array(), true); |
| 1045 |
|
} |
| 1046 |
|
|
| 1047 |
|
// return the ID of the persisted entity |
| 1048 |
|
return $product[$pkName]; |
| 1049 |
|
} |
| 1050 |
|
|
| 1051 |
|
/** |
| 1052 |
|
* Persist's the passed product varchar attribute. |
|
@@ 1059-1076 (lines=18) @@
|
| 1056 |
|
* |
| 1057 |
|
* @return string The ID of the persisted attribute |
| 1058 |
|
*/ |
| 1059 |
|
public function persistProductVarcharAttribute($attribute, $name = null) |
| 1060 |
|
{ |
| 1061 |
|
|
| 1062 |
|
// persist the new entity and set the PK value in the entity |
| 1063 |
|
$attribute[$pkName = $this->getProductVarcharRepository()->getPrimaryKeyName()] = $this->getProductVarcharAction()->persist($attribute, $name); |
| 1064 |
|
|
| 1065 |
|
// load the cache adapter instance |
| 1066 |
|
$cacheAdapter = $this->getProductVarcharRepository()->getCacheAdapter(); |
| 1067 |
|
|
| 1068 |
|
// we only want to replace existing values, NOT adding new ones as this is the responsibility of the repository |
| 1069 |
|
if ($cacheAdapter->isCached($uniqueKey = array(CacheKeys::PRODUCT_VARCHAR => $attribute[$pkName]))) { |
| 1070 |
|
// add the attribute value to the cache, register the cache key reference as well |
| 1071 |
|
$cacheAdapter->toCache($uniqueKey, $attribute, array(), array(), true); |
| 1072 |
|
} |
| 1073 |
|
|
| 1074 |
|
// return the ID of the persisted attribute |
| 1075 |
|
return $attribute[$pkName]; |
| 1076 |
|
} |
| 1077 |
|
|
| 1078 |
|
/** |
| 1079 |
|
* Persist's the passed product integer attribute. |