Skip to content

Instantly share code, notes, and snippets.

View kamaulynder's full-sized avatar
💭
Need great Female Tech Talent, talk to me!!

Linda Kamau kamaulynder

💭
Need great Female Tech Talent, talk to me!!
View GitHub Profile
public function interact(Tag $tag, TagData $input)
{
if ($input->role)
{
$role = $input->role;
$input->role = json_encode($role);
}
// We only want to work with values that have been changed
// TagRepository
public function search(TagSearchData $search, Array $params = null)
{
$where = Arr::extract($search->asArray(), ['tag', 'type','role']);
if ($search->parent) {
$where['parent_id'] = $search->parent;
}
if ($search->role) {
$where['role'] = $search->role;
{"errors":[{"message":"Cannot add or update a child row: a foreign key constraint fails (`lindalinda`.`tags`, CONSTRAINT `fk_tags_role` FOREIGN KEY (`role`) REFERENCES `roles` (`name`) ON DELETE SET NULL) [ UPDATE `tags` SET `role` = '[\\\"admin\\\",\\\"user\\\"]' WHERE `id` = '2' ]","code":1452,"class":"Database_Exception","file":"\/private\/var\/wwwdocs\/Lamu\/application\/classes\/Database\/MySQLi.php","line":155,"trace":[{"file":"\/private\/var\/wwwdocs\/Lamu\/modules\/database\/classes\/Kohana\/Database\/Query.php","line":251,"function":"query","class":"Database_MySQLi","type":"->","args":[3,"UPDATE `tags` SET `role` = '[\\\"admin\\\",\\\"user\\\"]' WHERE `id` = '2'",false,[]]},{"file":"\/private\/var\/wwwdocs\/Lamu\/application\/classes\/Ushahidi\/Repository.php","line":123,"function":"execute","class":"Kohana_Database_Query","type":"->","args":[{"last_query":"SELECT COUNT(*) AS `total` FROM `tags` WHERE `slug` IS NULL"}]},{"file":"\/private\/var\/wwwdocs\/Lamu\/application\/classes\/Ushahidi\/Repositor
namespace Ushahidi\Usecase\Tag;
use Ushahidi\Entity\Tag;
use Ushahidi\Tool\Validator;
use Ushahidi\Exception\ValidatorException;
class Update
{
private $repo;
private $valid;
protected function create_or_update_tag($tag, $post)
{
// Check
if (isset($post['parent']))
{
// If we have a parent array with url/id
if (is_array($post['parent']) AND isset($post['parent']['id']))
{
$post['parent_id'] = $post['parent']['id'];
}
role : {
type : 'Select',
title : 'Role',
options : App.Collections.Roles,
editorAttrs : {
multiple : true
}
}
{"errors":[{"message":"Unknown column 'messages.contact_id' in 'on clause' [ SELECT COUNT(DISTINCT `message`.`id`) AS `records_found`, `message`.`id` AS `id`, `message`.`parent_id` AS `parent_id`, `message`.`contact_id` AS `contact_id`, `message`.`post_id` AS `post_id`, `message`.`data_provider` AS `data_provider`, `message`.`data_provider_message_id` AS `data_provider_message_id`, `message`.`title` AS `title`, `message`.`message` AS `message`, `message`.`datetime` AS `datetime`, `message`.`type` AS `type`, `message`.`status` AS `status`, `message`.`direction` AS `direction`, `message`.`created` AS `created` FROM `messages` AS `message` JOIN `contacts` ON (`messages`.`contact_id` = `contacts`.`id`) ORDER BY `created` DESC ]","code":1054,"class":"Database_Exception","file":"\/private\/var\/wwwdocs\/Lamu\/application\/classes\/Database\/MySQLi.php","line":155,"trace":[{"file":"\/private\/var\/wwwdocs\/Lamu\/modules\/database\/classes\/Kohana\/Database\/Query.php","line":251,"function":"query","class":"Database_
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Ushahidi API Stats Controller
*
* @author Ushahidi Team <[email protected]>
* @package Ushahidi\Application\Controllers
* @copyright 2013 Ushahidi
* @license https://www.gnu.org/licenses/agpl-3.0.html GNU Affero General Public License Version 3 (AGPL3)
*/
@statsFixture @oauth2Skip
Feature: Testing the Stats API
@resetFixture
Scenario: Getting a count
Given that I want to count all "Tags"
When I request "/stats"
Then the response is JSON
And the type of the "count" property is "numeric"
And the "count" property equals "6"
/**
* Get a count of tags,posts,sets,users
*
* GET /api/stats
*
* @return void
*/
public function action_get_index_collection()