Skip to content

Commit fbdfc6b

Browse files
committed
Update doc blocks
1 parent 4e1a99e commit fbdfc6b

File tree

2 files changed

+53
-29
lines changed

2 files changed

+53
-29
lines changed

src/LightQL/Entities/EntityManager.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ public function find(string $entityClass, $id): Entity
103103
{
104104
$entityAnnotation = Annotations::ofClass($entityClass, "@entity");
105105

106+
/** @var Entity $entity */
106107
$entity = new $entityClass;
107108
$columns = $entity->getColumns();
108109

@@ -132,7 +133,7 @@ public function find(string $entityClass, $id): Entity
132133
* @param Entity $entity The entity to create.
133134
*
134135
* @throws \ElementaryFramework\Annotations\Exceptions\AnnotationException
135-
* @throws \ElementaryFramework\LightQL\Exceptions\LightQLException
136+
* @throws \ElementaryFramework\LightQL\Exceptions\EntityException
136137
*/
137138
public function persist(Entity &$entity)
138139
{
@@ -175,7 +176,7 @@ public function persist(Entity &$entity)
175176
* @param Entity $entity The entity to edit.
176177
*
177178
* @throws \ElementaryFramework\Annotations\Exceptions\AnnotationException
178-
* @throws \ElementaryFramework\LightQL\Exceptions\LightQLException
179+
* @throws \ElementaryFramework\LightQL\Exceptions\EntityException
179180
*/
180181
public function merge(Entity &$entity)
181182
{
@@ -215,7 +216,7 @@ public function merge(Entity &$entity)
215216
* @param Entity $entity The entity to delete.
216217
*
217218
* @throws \ElementaryFramework\Annotations\Exceptions\AnnotationException
218-
* @throws \ElementaryFramework\LightQL\Exceptions\LightQLException
219+
* @throws \ElementaryFramework\LightQL\Exceptions\EntityException
219220
*/
220221
public function delete(Entity &$entity)
221222
{

src/LightQL/LightQL.php

Lines changed: 49 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public static function registerAnnotations()
218218
*
219219
* @param array $options The lists of options
220220
*
221-
* @throws LightQLException
221+
* @throws \ElementaryFramework\LightQL\Exceptions\LightQLException
222222
*/
223223
public function __construct(array $options = null)
224224
{
@@ -381,7 +381,7 @@ public function close(): void
381381
/**
382382
* Connect to the database / Instantiate PDO
383383
*
384-
* @throws LightQLException When the connexion fails.
384+
* @throws \ElementaryFramework\LightQL\Exceptions\LightQLException When the connexion fails.
385385
*
386386
* @return void
387387
*/
@@ -414,7 +414,7 @@ public function getQueryString(): string
414414
*
415415
* @param string $table The table's name
416416
*
417-
* @return LightQL
417+
* @return \ElementaryFramework\LightQL\LightQL
418418
*/
419419
public function from(string $table): LightQL
420420
{
@@ -427,7 +427,7 @@ public function from(string $table): LightQL
427427
*
428428
* @param string|array $condition SQL condition in valid format
429429
*
430-
* @return LightQL
430+
* @return \ElementaryFramework\LightQL\LightQL
431431
*/
432432
public function where($condition): LightQL
433433
{
@@ -466,7 +466,7 @@ public function where($condition): LightQL
466466
* @param string $column The column to sort.
467467
* @param string $mode The sort mode.
468468
*
469-
* @return LightQL
469+
* @return \ElementaryFramework\LightQL\LightQL
470470
*/
471471
public function order(string $column, string $mode = "ASC"): LightQL
472472
{
@@ -480,7 +480,7 @@ public function order(string $column, string $mode = "ASC"): LightQL
480480
* @param int $offset The limit offset.
481481
* @param int $count The number of elements after the offset.
482482
*
483-
* @return LightQL
483+
* @return \ElementaryFramework\LightQL\LightQL
484484
*/
485485
public function limit(int $offset, int $count): LightQL
486486
{
@@ -493,7 +493,7 @@ public function limit(int $offset, int $count): LightQL
493493
*
494494
* @param string $column The column used to group results.
495495
*
496-
* @return LightQL
496+
* @return \ElementaryFramework\LightQL\LightQL
497497
*/
498498
public function groupBy(string $column): LightQL
499499
{
@@ -504,7 +504,7 @@ public function groupBy(string $column): LightQL
504504
/**
505505
* Add a distinct clause.
506506
*
507-
* @return LightQL
507+
* @return \ElementaryFramework\LightQL\LightQL
508508
*/
509509
public function distinct(): LightQL
510510
{
@@ -518,7 +518,7 @@ public function distinct(): LightQL
518518
* @param mixed $columns The fields to select. This value can be an array of fields,
519519
* or a string of fields (according to the SELECT SQL query syntax).
520520
*
521-
* @throws LightQLException
521+
* @throws \ElementaryFramework\LightQL\Exceptions\LightQLException
522522
*
523523
* @return \PDOStatement
524524
*/
@@ -533,7 +533,7 @@ public function select($columns = "*"): \PDOStatement
533533
* @param mixed $columns The fields to select. This value can be an array of fields,
534534
* or a string of fields (according to the SELECT SQL query syntax).
535535
*
536-
* @throws LightQLException
536+
* @throws \ElementaryFramework\LightQL\Exceptions\LightQLException
537537
*
538538
* @return \PDOStatement
539539
*/
@@ -591,7 +591,7 @@ public function prepare(string $query, array $options = array()): \PDOStatement
591591
}
592592

593593
/**
594-
* Reset all clauses
594+
* Reset all clauses.
595595
*/
596596
protected function resetClauses()
597597
{
@@ -608,7 +608,7 @@ protected function resetClauses()
608608
* @param mixed $columns The fields to select. This value can be an array of fields,
609609
* or a string of fields (according to the SELECT SQL query syntax).
610610
*
611-
* @throws LightQLException
611+
* @throws \ElementaryFramework\LightQL\Exceptions\LightQLException
612612
*
613613
* @return array
614614
*/
@@ -629,7 +629,7 @@ public function selectFirst($columns = "*")
629629
* @param mixed $columns The fields to select. This value can be an array of fields,
630630
* or a string of fields (according to the SELECT SQL query syntax).
631631
*
632-
* @throws LightQLException
632+
* @throws \ElementaryFramework\LightQL\Exceptions\LightQLException
633633
*
634634
* @return array
635635
*/
@@ -651,7 +651,7 @@ public function selectArray($columns = "*"): array
651651
* @param mixed $columns The fields to select. This value can be an array of fields,
652652
* or a string of fields (according to the SELECT SQL query syntax).
653653
*
654-
* @throws LightQLException
654+
* @throws \ElementaryFramework\LightQL\Exceptions\LightQLException
655655
*
656656
* @return array
657657
*/
@@ -674,7 +674,7 @@ public function selectObject($columns = "*"): array
674674
* or a string of fields (according to the SELECT SQL query syntax).
675675
* @param mixed $params The information used for JOIN.
676676
*
677-
* @throws LightQLException
677+
* @throws \ElementaryFramework\LightQL\Exceptions\LightQLException
678678
*
679679
* @return \PDOStatement
680680
*/
@@ -690,7 +690,7 @@ public function join($columns, $params): \PDOStatement
690690
* or a string of fields (according to the SELECT SQL query syntax).
691691
* @param string|array $params The information used for JOIN.
692692
*
693-
* @throws LightQLException
693+
* @throws \ElementaryFramework\LightQL\Exceptions\LightQLException
694694
*
695695
* @return \PDOStatement
696696
*/
@@ -735,7 +735,7 @@ private function _join($columns, $params): \PDOStatement
735735
* or a string of fields (according to the SELECT SQL query syntax).
736736
* @param mixed $params The information used for JOIN.
737737
*
738-
* @throws LightQLException
738+
* @throws \ElementaryFramework\LightQL\Exceptions\LightQLException
739739
*
740740
* @return array
741741
*/
@@ -758,7 +758,7 @@ public function joinArray($columns, $params): array
758758
* or a string of fields (according to the SELECT SQL query syntax).
759759
* @param mixed $params The information used for JOIN.
760760
*
761-
* @throws LightQLException
761+
* @throws \ElementaryFramework\LightQL\Exceptions\LightQLException
762762
*
763763
* @return array
764764
*/
@@ -780,7 +780,7 @@ public function joinObject($columns, $params): array
780780
* @param string|array $columns The fields to select. This value can be an array of fields,
781781
* or a string of fields (according to the SELECT SQL query syntax).
782782
*
783-
* @throws LightQLException
783+
* @throws \ElementaryFramework\LightQL\Exceptions\LightQLException
784784
*
785785
* @return int|array
786786
*/
@@ -798,7 +798,7 @@ public function count($columns = "*")
798798
if (null === $this->_group) {
799799
$this->resetClauses();
800800
$data = $getFieldsData->fetch();
801-
return (int)$data['lightql_count'];
801+
return (int) $data['lightql_count'];
802802
}
803803

804804
$this->resetClauses();
@@ -819,7 +819,7 @@ public function count($columns = "*")
819819
*
820820
* @param array $fieldsAndValues The fields and the associated values to insert.
821821
*
822-
* @throws LightQLException
822+
* @throws \ElementaryFramework\LightQL\Exceptions\LightQLException
823823
*
824824
* @return boolean
825825
*/
@@ -855,7 +855,7 @@ public function insert(array $fieldsAndValues): bool
855855
* @param array $values The array of list of values to insert
856856
* into the specified fields.
857857
*
858-
* @throws LightQLException
858+
* @throws \ElementaryFramework\LightQL\Exceptions\LightQLException
859859
*
860860
* @return boolean
861861
*/
@@ -885,7 +885,7 @@ public function insertMany(array $columns, array $values): bool
885885
*
886886
* @param array $fieldsAndValues The fields and the associated values to update.
887887
*
888-
* @throws LightQLException
888+
* @throws \ElementaryFramework\LightQL\Exceptions\LightQLException
889889
*
890890
* @return boolean
891891
*/
@@ -919,7 +919,7 @@ public function update(array $fieldsAndValues): bool
919919
/**
920920
* Deletes data in table.
921921
*
922-
* @throws LightQLException
922+
* @throws \ElementaryFramework\LightQL\Exceptions\LightQLException
923923
*
924924
* @return boolean
925925
*/
@@ -940,7 +940,7 @@ public function delete(): bool
940940
/**
941941
* Truncates a table.
942942
*
943-
* @throws LightQLException
943+
* @throws \ElementaryFramework\LightQL\Exceptions\LightQLException
944944
*
945945
* @return boolean
946946
*/
@@ -964,9 +964,9 @@ public function truncate(): bool
964964
* @param string $query The query to execute
965965
* @param int $mode The fetch mode
966966
*
967-
* @return \PDOStatement
968967
* @uses \PDO::query()
969968
*
969+
* @return \PDOStatement
970970
*/
971971
public function query(string $query, int $mode = \PDO::FETCH_LAZY): \PDOStatement
972972
{
@@ -977,6 +977,8 @@ public function query(string $query, int $mode = \PDO::FETCH_LAZY): \PDOStatemen
977977
* Gets the last inserted id by an
978978
* INSERT query.
979979
*
980+
* @uses \PDO::lastInsertId()
981+
*
980982
* @return int
981983
*/
982984
public function lastInsertID(): int
@@ -998,16 +1000,37 @@ public function quote($value): string
9981000
return $this->_pdo->quote($value);
9991001
}
10001002

1003+
/**
1004+
* Disable auto commit mode and start a transaction.
1005+
*
1006+
* @uses \PDO::beginTransaction()
1007+
*
1008+
* @return bool
1009+
*/
10011010
public function beginTransaction(): bool
10021011
{
10031012
return $this->_pdo->beginTransaction();
10041013
}
10051014

1015+
/**
1016+
* Commit changes made during a transaction.
1017+
*
1018+
* @uses \PDO::commit()
1019+
*
1020+
* @return bool
1021+
*/
10061022
public function commit(): bool
10071023
{
10081024
return $this->_pdo->commit();
10091025
}
10101026

1027+
/**
1028+
* Rollback changes made during a transaction.
1029+
*
1030+
* @uses \PDO::rollBack()
1031+
*
1032+
* @return bool
1033+
*/
10111034
public function rollback(): bool
10121035
{
10131036
return $this->_pdo->rollBack();

0 commit comments

Comments
 (0)