Skip to content

Commit a305237

Browse files
committed
Fix few issues
1 parent 32a9ce2 commit a305237

File tree

3 files changed

+16
-15
lines changed

3 files changed

+16
-15
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,7 @@ Lastly, you can disable cache per single request by passing the following query
701701
> **Notes:**
702702
> - Repository level cache MUST be enabled for any lower level cache to work (query cache), otherwise it's considered disabled even if explicitly enabled per query.
703703
> - You can control how long repository cache lasts through the `rinvex.repository.cache.lifetime` config option, or per individual query through the `$lifetime` parameter.
704+
> - Repositories intelligently pass missing methods to the underlying model, so you actually can implement any kind of logic, or even complex queries by utilizing the repository model or the query builder.
704705
> - For more insights about the Active Repository implementation, I've published an article on the topic titled [Active Repository is good & Awesomely Usable](https://blog.omranic.com/active-repository-is-good-awesomely-usable-6991cfd58774), read it if you're interested.
705706
> - **Rinvex Repository** utilizes cache tags in a very smart way, even if your chosen cache driver doesn't support cache tags it will manage it virtually on it's own for precise cache management. Behind scenes it uses a json file to store cache keys. Checkout the `rinvex.repository.cache.keys_file` config option to change file path.
706707
> - **Rinvex Repository** follows the FIG PHP Standards Recommendations compliant with the [PSR-1: Basic Coding Standard](http://www.php-fig.org/psr/psr-1/), [PSR-2: Coding Style Guide](http://www.php-fig.org/psr/psr-2/) and [PSR-4: Autoloader](http://www.php-fig.org/psr/psr-4/) to ensure a high level of interoperability between shared PHP code.

src/Contracts/RepositoryContract.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,10 @@ public function with(array $relations);
145145
/**
146146
* Add a basic where clause to the query.
147147
*
148-
* @param string $attribute
149-
* @param string $operator
150-
* @param mixed $value
151-
* @param string $boolean
148+
* @param string $attribute
149+
* @param string $operator
150+
* @param mixed $value
151+
* @param string $boolean
152152
*
153153
* @return $this
154154
*/

src/Repositories/BaseRepository.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ abstract class BaseRepository implements RepositoryContract
4545
/**
4646
* The repository cache lifetime.
4747
*
48-
* @var int
48+
* @var float|int
4949
*/
5050
protected $cacheLifetime;
5151

@@ -226,7 +226,7 @@ protected function resetRepository()
226226
protected function prepareQuery($model)
227227
{
228228
// Set the relationships that should be eager loaded
229-
if ($this->relations) {
229+
if (! empty($this->relations)) {
230230
$model = $model->with($this->relations);
231231
}
232232

@@ -262,7 +262,7 @@ protected function prepareQuery($model)
262262
}
263263

264264
// Add an "order by" clause to the query.
265-
if ($this->orderBy) {
265+
if (! empty($this->orderBy)) {
266266
list($attribute, $direction) = $this->orderBy;
267267

268268
$model = $model->orderBy($attribute, $direction);
@@ -517,10 +517,10 @@ public function with(array $relations)
517517
/**
518518
* Add a basic where clause to the query.
519519
*
520-
* @param string $attribute
521-
* @param string $operator
522-
* @param mixed $value
523-
* @param string $boolean
520+
* @param string $attribute
521+
* @param string $operator
522+
* @param mixed $value
523+
* @param string $boolean
524524
*
525525
* @return $this
526526
*/
@@ -535,10 +535,10 @@ public function where($attribute, $operator = null, $value = null, $boolean = 'a
535535
/**
536536
* Add a "where in" clause to the query.
537537
*
538-
* @param string $attribute
539-
* @param mixed $values
540-
* @param string $boolean
541-
* @param bool $not
538+
* @param string $attribute
539+
* @param mixed $values
540+
* @param string $boolean
541+
* @param bool $not
542542
*
543543
* @return $this
544544
*/

0 commit comments

Comments
 (0)