Skip to content

Cleanup and tests #2567

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
ea2da7a
PHPORM-39: Add namespace for tests directory (#2)
alcaeus Jun 29, 2023
b6e8a44
Add classes to cast ObjectId and UUID instances (#1)
alcaeus Jun 29, 2023
bc364b5
PHPORM-44: Throw an exception when Query\Builder::push() is used inco…
GromNaN Jul 11, 2023
60a22f4
PHPORM-45 Add Query\Builder::toMql() to simplify comprehensive query …
GromNaN Jul 12, 2023
843904b
Create UTCDateTime from DateTimeInterface objects (#8)
GromNaN Jul 12, 2023
8562a4b
PHPORM-46 Throw an exception when Query\Builder::orderBy() is used wi…
GromNaN Jul 12, 2023
4658d54
PHPORM-51 Throw an exception when unsupported query builder method is…
GromNaN Jul 12, 2023
78319d4
Optimize calls to debug_backtrace (#11)
GromNaN Jul 13, 2023
bd86f85
Add header documentation for classes & traits that can be used in app…
GromNaN Jul 13, 2023
cf103ba
PHPORM-47 Improve Builder::whereBetween to support CarbonPeriod and r…
GromNaN Jul 19, 2023
9d9c7c8
PHPORM-49 Implement `Query\Builder::whereNot` by encapsulating into `…
GromNaN Jul 19, 2023
52c0ea3
PHPORM-49 Implement `Query\Builder::whereNot` by encapsulating into `…
GromNaN Jul 20, 2023
9cbadea
PHPORM-50 PHPORM-65 Remove call to deprecated Collection::count for c…
GromNaN Jul 26, 2023
03c58ea
PHPORM-67 Accept operators prefixed by $ in Query\Builder::orWhere (#20)
GromNaN Jul 26, 2023
b0b796c
PHPORM-33 Add tests on Query\Builder methods (#14)
GromNaN Jul 26, 2023
2824dc4
PHPORM-64 Remove Query\Builder::whereAll (#16)
GromNaN Jul 26, 2023
3a46876
PHPORM-68 Fix unique validator when the validated value is part of an…
GromNaN Jul 26, 2023
2319d53
PHPORM-53 Fix and test `like` and `regex` operators (#17)
GromNaN Jul 27, 2023
9f1f8f3
PHPORM-35 Add various tests on Model `_id` types (#22)
GromNaN Aug 2, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add header documentation for classes & traits that can be used in app…
…lications (#12)

* Add header documentation for classes & traits that can be used in applications
* Precise mixed types when possible
  • Loading branch information
GromNaN authored Jul 13, 2023
commit bd86f85768f02ab23bcbb9bc5c2a65fa878362d3
3 changes: 3 additions & 0 deletions src/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
use MongoDB\BSON\ObjectID;
use MongoDB\Collection as MongoCollection;

/**
* @mixin MongoCollection
*/
class Collection
{
/**
Expand Down
3 changes: 3 additions & 0 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
use MongoDB\Database;
use Throwable;

/**
* @mixin Database
*/
class Connection extends BaseConnection
{
use ManagesTransactions;
Expand Down
2 changes: 1 addition & 1 deletion src/Eloquent/Casts/BinaryUuid.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function get($model, string $key, $value, array $attributes)
* @param string $key
* @param mixed $value
* @param array $attributes
* @return mixed
* @return Binary
*/
public function set($model, string $key, $value, array $attributes)
{
Expand Down
3 changes: 3 additions & 0 deletions src/Eloquent/EmbedsRelations.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
use Jenssegers\Mongodb\Relations\EmbedsMany;
use Jenssegers\Mongodb\Relations\EmbedsOne;

/**
* Embeds relations for MongoDB models.
*/
trait EmbedsRelations
{
/**
Expand Down
4 changes: 4 additions & 0 deletions src/Eloquent/HybridRelations.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
use Jenssegers\Mongodb\Relations\MorphMany;
use Jenssegers\Mongodb\Relations\MorphTo;

/**
* Cross-database relationships between SQL and MongoDB.
* Use this trait in SQL models to define relationships with MongoDB models.
*/
trait HybridRelations
{
/**
Expand Down
14 changes: 7 additions & 7 deletions src/Query/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -788,9 +788,9 @@ public function raw($expression = null)
/**
* Append one or more values to an array.
*
* @param mixed $column
* @param mixed $value
* @param bool $unique
* @param string|array $column
* @param mixed $value
* @param bool $unique
* @return int
*/
public function push($column, $value = null, $unique = false)
Expand Down Expand Up @@ -818,14 +818,14 @@ public function push($column, $value = null, $unique = false)
/**
* Remove one or more values from an array.
*
* @param mixed $column
* @param mixed $value
* @param string|array $column
* @param mixed $value
* @return int
*/
public function pull($column, $value = null)
{
// Check if we passed an associative array.
$batch = (is_array($value) && array_keys($value) === range(0, count($value) - 1));
$batch = is_array($value) && array_is_list($value);

// If we are pulling multiple values, we need to use $pullAll.
$operator = $batch ? '$pullAll' : '$pull';
Expand All @@ -842,7 +842,7 @@ public function pull($column, $value = null)
/**
* Remove one or more fields.
*
* @param mixed $columns
* @param string|string[] $columns
* @return int
*/
public function drop($columns)
Expand Down