31 if (!($day instanceof
Date))
34 if (! is_string($name))
37 if (! is_numeric($value))
40 if ((
$id = $this->
id) ===
null)
49 if (! $type = $types[$name])
52 if (! $type[
'ACTIVE'])
63 $data = array(
'VALUE' =>
new DB\
SqlExpression(
'?# + ?f',
'VALUE', $value));
65 $result = ContextCounterDayTable::update($primary, $data);
67 if ($result->getAffectedRowsCount() === 0)
71 $result = ContextCounterDayTable::add($primary + array(
'VALUE' => $value));
75 $result = ContextCounterDayTable::update($primary, $data);
129 if ((
$id =& $this->
id) !==
null)
138 static $groupedTypes;
143 unset($groupedTypes[
null]);
146 foreach ($groupedTypes as $types)
148 $intersection = array_intersect_key($types,
$attributes);
150 if (count($intersection) > 1)
152 array_shift($intersection);
154 foreach ($intersection as $name => $type)
167 'select' => array(
'ID'),
168 'filter' => array(
'=SNAPSHOT' => $snapshot),
171 if ($row = ContextTable::getList($query)->fetch())
173 $id = (int) $row[
'ID'];
175 elseif (Option::get(
'conversion',
'CONTEXT_TABLE') !=
'locked')
179 $result = ContextTable::add(array(
'SNAPSHOT' => $snapshot));
181 if ($result->isSuccess())
183 $id = $result->getId();
188 $result = ContextAttributeTable::add(array(
191 'VALUE' => (
string) $value,
202 if ($row = ContextTable::getList($query)->fetch())
204 $id = (int) $row[
'ID'];