public function update(Entity $entity) { // Get changed values $record = $entity->getChanged(); // Set the updated time $record['updated'] = time(); // Finally, update the record in the DB return $this->executeUpdate(['id' => $entity->id, 'search' => (int) $this->savedSearch], $record); }
protected function verifyValid(Entity $entity) { $changed = $entity->getChanged(); if (isset($entity->id)) { $changed['id'] = $entity->id; } if (!$this->validator->check($changed)) { $this->validatorError($entity); } }
protected function verifyValid(Entity $entity) { $changed = $entity->getChanged(); // Always pass values to validation if (isset($entity->values)) { $changed['values'] = $entity->values; } if (!$this->validator->check($changed, $entity->asArray())) { $this->validatorError($entity); } }
public function update(Entity $entity) { $group = $entity->getId(); $this->verifyGroup($group); $config = \Kohana::$config->load($group); $immutable = $entity->getImmutable(); foreach ($entity->getChanged() as $key => $val) { if (!in_array($key, $immutable)) { $config->set($key, $val); } } }
public function update(Entity $entity) { $role = $entity->getChanged(); // Remove permissions unset($role['permissions']); // ... Update the post $count = $this->executeUpdate(['id' => $entity->id], $role); // ... Update permissions if ($entity->hasChanged('permissions')) { $this->updatePermissions($entity->name, $entity->permissions); } return $count; }
protected function verifyValid(Entity $entity) { $changed = $entity->getChanged(); if (isset($entity->id)) { $changed['id'] = $entity->id; } // Always pass form_id to validation if (isset($entity->form_id)) { $changed['form_id'] = $entity->form_id; } // Always pass values to validation if (isset($entity->values)) { $changed['values'] = $entity->values; } if (!$this->validator->check($changed)) { $this->validatorError($entity); } }
protected function verifyValid(Entity $entity) { if (!$this->validator->check($entity->getChanged())) { $this->validatorError($entity); } }
public function update(Entity $entity) { $post = $entity->getChanged(); $post['updated'] = time(); // Remove attribute values and tags unset($post['values'], $post['tags'], $post['completed_stages']); // Update the post $count = $this->executeUpdate(['id' => $entity->id], $post); if ($entity->hasChanged('tags')) { // Update post-tags $this->updatePostTags($entity->id, $entity->tags); } if ($entity->hasChanged('values')) { // Update post-values $this->updatePostValues($entity->id, $entity->values); } if ($entity->hasChanged('completed_stages')) { // Update post-stages $this->updatePostStages($entity->id, $entity->form_id, $entity->completed_stages); } return $count; }
public function update(Entity $entity) { $update = $entity->getChanged(); $update['updated'] = time(); return $this->executeUpdate(['id' => $entity->id], $update); }
public function update(Entity $entity) { return $this->executeUpdate(['id' => $entity->id], $entity->getChanged()); }
public function update(Entity $entity) { $record = $this->json_transcoder->encode($entity->getChanged(), $this->json_properties); return $this->executeUpdate(['id' => $entity->getId()], $record); }
public function update(Entity $entity) { $post = $entity->getChanged(); $post['updated'] = time(); // Remove attribute values and tags unset($post['values'], $post['tags'], $post['completed_stages'], $post['sets'], $post['source'], $post['color']); // Convert post_date to mysql format if (!empty($post['post_date'])) { $post['post_date'] = $post['post_date']->format("Y-m-d H:i:s"); } $count = $this->executeUpdate(['id' => $entity->id], $post); if ($entity->hasChanged('tags')) { // Update post-tags $this->updatePostTags($entity->id, $entity->tags); } if ($entity->hasChanged('values')) { // Update post-values $this->updatePostValues($entity->id, $entity->values); } if ($entity->hasChanged('completed_stages')) { // Update post-stages $this->updatePostStages($entity->id, $entity->form_id, $entity->completed_stages); } return $count; }
public function update(Entity $entity) { $record = $entity->getChanged(); $record['updated'] = time(); return $this->executeUpdate(['id' => $entity->id, 'search' => (int) $this->savedSearch], $entity->getChanged()); }
public function update(Entity $entity) { $update = $this->json_transcoder->encode($entity->getChanged(), $this->json_properties); $update['updated'] = time(); return $this->executeUpdate(['id' => $entity->id], $update); }