-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #625 from octobercms/develop
OC Release - v3.6
- Loading branch information
Showing
70 changed files
with
2,072 additions
and
930 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
/** | ||
* Auth | ||
* | ||
* @see \RainLab\User\Classes\AuthManager | ||
*/ | ||
class Auth extends October\Rain\Support\Facades\Auth {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
/** | ||
* Currency | ||
* | ||
* @see \Responsiv\Shop\Classes\CurrencyManager | ||
*/ | ||
class Currency extends October\Rain\Support\Facades\Currency {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php namespace October\Rain\Auth\Concerns; | ||
|
||
/** | ||
* HasProviderProxy provides proxy methods to emulate Laravel's auth provider | ||
* | ||
* @package october\auth | ||
* @author Alexey Bobkov, Samuel Georges | ||
*/ | ||
trait HasProviderProxy | ||
{ | ||
/** | ||
* getProvider just passes it back to the current class | ||
*/ | ||
public function getProvider() | ||
{ | ||
return $this; | ||
} | ||
|
||
/** | ||
* getModel returns the class name for the user model | ||
*/ | ||
public function getModel() | ||
{ | ||
return $this->userModel; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php namespace October\Rain\Database\Concerns; | ||
|
||
use Closure; | ||
|
||
/** | ||
* HasEagerLoadAttachRelation eagerly loads all attachments on a model in one pass. | ||
* Since they share a common type and database table, multiple attachment definitions | ||
* can be eagerly loaded as a single query. | ||
*/ | ||
trait HasEagerLoadAttachRelation | ||
{ | ||
/** | ||
* @var array eagerLoadAttachResultCache | ||
*/ | ||
protected $eagerLoadAttachResultCache = []; | ||
|
||
/** | ||
* eagerLoadAttachRelation eagerly loads an attachment relationship on a set of models. | ||
* @param string $relatedModel | ||
* @param array $models | ||
* @param string $name | ||
* @param \Closure $constraints | ||
* @return array|null | ||
*/ | ||
protected function eagerLoadAttachRelation(array $models, $name, Closure $constraints) | ||
{ | ||
// Look up relation type | ||
$relationType = $this->getModel()->getRelationType($name); | ||
if (!$relationType || !in_array($relationType, ['attachOne', 'attachMany'])) { | ||
return null; | ||
} | ||
|
||
// Only vanilla attachments are supported, pass complex lookups back to Laravel | ||
$definition = $this->getModel()->getRelationDefinition($name); | ||
if (isset($definition['conditions']) || isset($definition['scope'])) { | ||
return null; | ||
} | ||
|
||
// Opt-out of the combined eager loading logic | ||
if (isset($definition['combineEager']) && $definition['combineEager'] === false) { | ||
return null; | ||
} | ||
|
||
$relation = $this->getRelation($name); | ||
$relatedModel = get_class($relation->getRelated()); | ||
|
||
// Perform a global look up attachment without the 'field' constraint | ||
// to produce a combined subset of all possible attachment relations. | ||
if (!isset($this->eagerLoadAttachResultCache[$relatedModel])) { | ||
$relation->addCommonEagerConstraints($models); | ||
|
||
// Note this takes first constraint only. If it becomes a problem one solution | ||
// could be to compare the md5 of toSql() to ensure uniqueness. The workaround | ||
// for this edge case is to set combineEager => false in the definition. | ||
$constraints($relation); | ||
|
||
$this->eagerLoadAttachResultCache[$relatedModel] = $relation->getEager(); | ||
} | ||
|
||
$results = $this->eagerLoadAttachResultCache[$relatedModel]; | ||
|
||
return $relation->match( | ||
$relation->initRelation($models, $name), | ||
$results->where('field', $name), | ||
$name | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.