Add UserQuery entity

This commit is contained in:
Nicolas Le Goff
2013-08-21 18:08:25 +02:00
parent 7909bc5688
commit cc631a1e7f
10 changed files with 233 additions and 58 deletions

View File

@@ -414,36 +414,6 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
return $this->ACL;
}
/**
* Query in the cache
*
* @param Application $app
* @param string $query
*
* @return boolean
*/
public static function saveQuery(Application $app, $query)
{
try {
$sql = "INSERT INTO dsel (id, name, usr_id, query)
VALUES (null, :name, :usr_id, :query)";
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute(array(
':name' => $query,
':usr_id' => $app['authentication']->getUser()->get_id(),
':query' => $query
));
$stmt->closeCursor();
if ($app['authentication']->getUser()->getPrefs('start_page') == 'LAST_QUERY')
$app['authentication']->getUser()->setPrefs('start_page_query', $query);
} catch (Exception $e) {
return false;
}
return true;
}
/**
*
* @return string

View File

@@ -128,8 +128,6 @@ interface User_Interface
public static function getInstance($id, Application $app);
public static function saveQuery(Application $app, $query);
public static function get_usr_id_from_login(Application $app, $login);
public static function get_usr_id_from_email(Application $app, $email);