~xibo-maintainers/xibo/tempel

« back to all changes in this revision

Viewing changes to lib/Entity/UserOption.php

  • Committer: Dan Garner
  • Date: 2016-02-18 16:07:16 UTC
  • mfrom: (454.4.137)
  • Revision ID: git-v1:8867f12675bc9e0e67e7e622c80da7471b9f294a
Merge pull request #139 from dasgarner/feature/nested-display-groups

Feature/nested display groups

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 
8
8
 
9
9
namespace Xibo\Entity;
10
 
use Xibo\Service\LogServiceInterface;
11
 
use Xibo\Storage\StorageServiceInterface;
12
 
 
 
10
 
 
11
 
 
12
use Xibo\Storage\PDOConnect;
13
13
 
14
14
/**
15
15
 * Class UserOption
39
39
     */
40
40
    public $value;
41
41
 
42
 
    /**
43
 
     * Entity constructor.
44
 
     * @param StorageServiceInterface $store
45
 
     * @param LogServiceInterface $log
46
 
     */
47
 
    public function __construct($store, $log)
 
42
    public function __construct()
48
43
    {
49
 
        $this->setCommonDependencies($store, $log);
50
44
        $this->excludeProperty('userId');
51
45
    }
52
46
 
53
47
    public function save()
54
48
    {
55
49
        $sql = 'INSERT INTO `useroption` (`userId`, `option`, `value`) VALUES (:userId, :option, :value) ON DUPLICATE KEY UPDATE `value` = :value2';
56
 
        $this->getStore()->insert($sql, array(
 
50
        PDOConnect::insert($sql, array(
57
51
            'userId' => $this->userId,
58
52
            'option' => $this->option,
59
53
            'value' => $this->value,
64
58
    public function delete()
65
59
    {
66
60
        $sql = 'DELETE FROM `useroption` WHERE `userId` = :userId AND `option` = :option';
67
 
        $this->getStore()->update($sql, array('userId' => $this->userId, 'option' => $this->option));
 
61
        PDOConnect::update($sql, array('userId' => $this->userId, 'option' => $this->option));
68
62
    }
69
63
}
 
 
b'\\ No newline at end of file'