@@ -66,18 +66,18 @@ |
||
66 | 66 | if (preg_match('/[A-Z]/', $key)) { |
67 | 67 | $parts = preg_split('/(?=[A-Z])/', $key, -1, PREG_SPLIT_NO_EMPTY); |
68 | 68 | if (strtolower($parts[0]) == 'own') { |
69 | - if (strtolower($parts[2]) == 'list') { |
|
70 | - return Database::getInstance()->find(strtolower($parts[1]))->where($this->getName() . '_id = "' . $this->_id.'"')->get(); |
|
69 | + if (strtolower($parts[2]) == 'list') { |
|
70 | + return Database::getInstance()->find(strtolower($parts[1]))->where($this->getName().'_id = "'.$this->_id.'"')->get(); |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | if (strtolower($parts[0]) == 'shared') { |
74 | - if (strtolower($parts[2]) == 'list') { |
|
74 | + if (strtolower($parts[2]) == 'list') { |
|
75 | 75 | $rel_table = Database::getInstance()->getTableManager()->tableExists($this->table.'_'.strtolower($parts[1])) ? $this->table.'_'.strtolower($parts[1]) : strtolower($parts[1]).'_'.$this->table; |
76 | - $relations = Database::getInstance()->find($rel_table)->where($this->getName() . '_id = "' . $this->_id.'"')->get(); |
|
76 | + $relations = Database::getInstance()->find($rel_table)->where($this->getName().'_id = "'.$this->_id.'"')->get(); |
|
77 | 77 | $rel_ids = ''; |
78 | 78 | foreach ($relations as $relation) { |
79 | - $key = strtolower($parts[1]) . '_id'; |
|
80 | - $rel_ids .= "'".$relation->$key . "',"; |
|
79 | + $key = strtolower($parts[1]).'_id'; |
|
80 | + $rel_ids .= "'".$relation->$key."',"; |
|
81 | 81 | } |
82 | 82 | $rel_ids = substr($rel_ids, 0, -1); |
83 | 83 | return Database::getInstance()->find(strtolower($parts[1]))->where('id IN ('.$rel_ids.')')->get(); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @param array $params |
32 | 32 | * @return integer |
33 | 33 | */ |
34 | - public function exec(string $sql, array $params=array()): int |
|
34 | + public function exec(string $sql, array $params = array()): int |
|
35 | 35 | { |
36 | 36 | return $this->connection->executeStatement($sql, $params); |
37 | 37 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @param array $params |
44 | 44 | * @return array |
45 | 45 | */ |
46 | - public function getAll(string $sql, array $params=[]): array |
|
46 | + public function getAll(string $sql, array $params = []): array |
|
47 | 47 | { |
48 | 48 | return $this->connection->executeQuery($sql, $params)->fetchAllAssociative(); |
49 | 49 | } |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | * @param mixed|null $id |
225 | 225 | * @return mixed |
226 | 226 | */ |
227 | - public function get(String $table, mixed $id=null) : mixed |
|
227 | + public function get(String $table, mixed $id = null) : mixed |
|
228 | 228 | { |
229 | 229 | if (is_null($id)) { |
230 | 230 | print('Get All Called \r \n'); |
@@ -58,7 +58,7 @@ |
||
58 | 58 | { |
59 | 59 | $table = new Table($model->getName()); |
60 | 60 | if ($this->db->isUsingUUID()) { |
61 | - $table->addColumn('id', 'string', ['length' => 36, 'notnull' => true,]); |
|
61 | + $table->addColumn('id', 'string', ['length' => 36, 'notnull' => true, ]); |
|
62 | 62 | } else { |
63 | 63 | $table->addColumn("id", "integer", array("unsigned" => true, "autoincrement" => true)); |
64 | 64 | } |
@@ -67,18 +67,18 @@ |
||
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
70 | - * Get single record by id |
|
71 | - * |
|
72 | - * @param \Scrawler\Arca\Model $model |
|
73 | - * @return \Scrawler\Arca\Model |
|
74 | - */ |
|
70 | + * Get single record by id |
|
71 | + * |
|
72 | + * @param \Scrawler\Arca\Model $model |
|
73 | + * @return \Scrawler\Arca\Model |
|
74 | + */ |
|
75 | 75 | public function getById(Model $model, mixed $id): Model |
76 | 76 | { |
77 | 77 | $qb = new QueryBuilder($this->db->connection); |
78 | 78 | $query = $qb |
79 | - ->select('*') |
|
80 | - ->from($model->getName(), 't') |
|
81 | - ->where("t.id = '".$id."'"); |
|
79 | + ->select('*') |
|
80 | + ->from($model->getName(), 't') |
|
81 | + ->where("t.id = '".$id."'"); |
|
82 | 82 | $result = $this->db->connection->executeQuery($query)->fetchAssociative(); |
83 | 83 | $result = $result ? $result : []; |
84 | 84 | $model->setProperties($result)->setLoaded(); |
@@ -75,7 +75,7 @@ |
||
75 | 75 | public function getById(Model $model, mixed $id): Model |
76 | 76 | { |
77 | 77 | $qb = new QueryBuilder($this->db->connection); |
78 | - $query = $qb |
|
78 | + $query = $qb |
|
79 | 79 | ->select('*') |
80 | 80 | ->from($model->getName(), 't') |
81 | 81 | ->where("t.id = '".$id."'"); |