Rename to RelationalEntity to avoid naming collission
This commit is contained in:
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
namespace OCA\Deck\Db;
|
namespace OCA\Deck\Db;
|
||||||
|
|
||||||
class Acl extends Entity implements \JsonSerializable {
|
class Acl extends RelationalEntity implements \JsonSerializable {
|
||||||
|
|
||||||
const PERMISSION_READ = 0;
|
const PERMISSION_READ = 0;
|
||||||
const PERMISSION_EDIT = 1;
|
const PERMISSION_EDIT = 1;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace OCA\Deck\Db;
|
|||||||
|
|
||||||
use JsonSerializable;
|
use JsonSerializable;
|
||||||
|
|
||||||
class Board extends Entity implements JsonSerializable {
|
class Board extends RelationalEntity implements JsonSerializable {
|
||||||
|
|
||||||
public $id;
|
public $id;
|
||||||
protected $title;
|
protected $title;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace OCA\Deck\Db;
|
|||||||
|
|
||||||
use JsonSerializable;
|
use JsonSerializable;
|
||||||
|
|
||||||
class Card extends Entity implements JsonSerializable {
|
class Card extends RelationalEntity implements JsonSerializable {
|
||||||
|
|
||||||
public $id;
|
public $id;
|
||||||
protected $title;
|
protected $title;
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class CardMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $id
|
* @param $id
|
||||||
* @return Entity if not found
|
* @return RelationalEntity if not found
|
||||||
*/
|
*/
|
||||||
public function find($id) {
|
public function find($id) {
|
||||||
$sql = 'SELECT * FROM `*PREFIX*deck_cards` ' .
|
$sql = 'SELECT * FROM `*PREFIX*deck_cards` ' .
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace OCA\Deck\Db;
|
|||||||
|
|
||||||
use JsonSerializable;
|
use JsonSerializable;
|
||||||
|
|
||||||
class Label extends Entity implements JsonSerializable {
|
class Label extends RelationalEntity implements JsonSerializable {
|
||||||
|
|
||||||
public $id;
|
public $id;
|
||||||
protected $title;
|
protected $title;
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
namespace OCA\Deck\Db;
|
namespace OCA\Deck\Db;
|
||||||
|
|
||||||
|
|
||||||
class Entity extends \OCP\AppFramework\Db\Entity {
|
class RelationalEntity extends \OCP\AppFramework\Db\Entity {
|
||||||
|
|
||||||
private $_relations = array();
|
private $_relations = array();
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ namespace OCA\Deck\Db;
|
|||||||
use JsonSerializable;
|
use JsonSerializable;
|
||||||
|
|
||||||
|
|
||||||
class Stack extends Entity implements JsonSerializable {
|
class Stack extends RelationalEntity implements JsonSerializable {
|
||||||
|
|
||||||
public $id;
|
public $id;
|
||||||
protected $title;
|
protected $title;
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
namespace OCA\Deck\Db;
|
namespace OCA\Deck\Db;
|
||||||
|
|
||||||
|
use OCP\AppFramework\Db\Entity;
|
||||||
use OCP\IDBConnection;
|
use OCP\IDBConnection;
|
||||||
|
|
||||||
|
|
||||||
@@ -53,7 +54,7 @@ class StackMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function delete(\OCP\AppFramework\Db\Entity $entity) {
|
public function delete(Entity $entity) {
|
||||||
// delete cards on stack
|
// delete cards on stack
|
||||||
$this->cardMapper->deleteByStack($entity->getId());
|
$this->cardMapper->deleteByStack($entity->getId());
|
||||||
return parent::delete($entity);
|
return parent::delete($entity);
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace OCA\Deck\Db;
|
|||||||
class EntityTest extends \PHPUnit_Framework_TestCase {
|
class EntityTest extends \PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
public function testRelation() {
|
public function testRelation() {
|
||||||
$entity = new Entity();
|
$entity = new RelationalEntity();
|
||||||
$entity->foo = null;
|
$entity->foo = null;
|
||||||
$entity->addRelation('foo');
|
$entity->addRelation('foo');
|
||||||
$entity->setFoo('test');
|
$entity->setFoo('test');
|
||||||
@@ -34,7 +34,7 @@ class EntityTest extends \PHPUnit_Framework_TestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function testWithoutRelation() {
|
public function testWithoutRelation() {
|
||||||
$entity = new Entity();
|
$entity = new RelationalEntity();
|
||||||
$entity->foo = null;
|
$entity->foo = null;
|
||||||
$entity->setFoo('test');
|
$entity->setFoo('test');
|
||||||
$this->assertEquals(['foo'=>true], $entity->getUpdatedFields());
|
$this->assertEquals(['foo'=>true], $entity->getUpdatedFields());
|
||||||
|
|||||||
Reference in New Issue
Block a user