Skip to content

Commit

Permalink
Merge branch '5.x' of https://github.com/statamic/cms into frontend-f…
Browse files Browse the repository at this point in the history
…orm-group
  • Loading branch information
jesseleite committed Feb 28, 2025
2 parents 22ab18d + 4c2e6ad commit 2ac8d5a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Release Notes

## 5.49.1 (2025-02-27)

### What's fixed
- Query for entry origin within the same collection [#11514](https://github.com/statamic/cms/issues/11514) by @jasonvarga
- Improve validation message when handle starts with a number [#11511](https://github.com/statamic/cms/issues/11511) by @duncanmcclean
- Fix target `.git` repo handling when exporting starter kit with `--clear` [#11509](https://github.com/statamic/cms/issues/11509) by @jesseleite
- Make active toolbar buttons of Bard more visible in dark mode [#11405](https://github.com/statamic/cms/issues/11405) by @carstenjaksch
- Alternate Laravel 12 token repository fix [#11505](https://github.com/statamic/cms/issues/11505) by @jasonvarga



## 5.49.0 (2025-02-25)

### What's new
Expand Down
2 changes: 1 addition & 1 deletion src/Entries/Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,7 @@ public static function __callStatic($method, $parameters)

protected function getOriginByString($origin)
{
return Facades\Entry::find($origin);
return $this->collection()->queryEntries()->where('id', $origin)->first();
}

protected function getOriginFallbackValues()
Expand Down
24 changes: 19 additions & 5 deletions tests/Data/Entries/EntryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use PHPUnit\Framework\Attributes\Test;
use ReflectionClass;
use Statamic\Contracts\Data\Augmentable;
use Statamic\Contracts\Entries\QueryBuilder;
use Statamic\Data\AugmentedCollection;
use Statamic\Entries\AugmentedEntry;
use Statamic\Entries\Collection;
Expand Down Expand Up @@ -1727,7 +1728,12 @@ public function it_gets_file_contents_for_saving_a_localized_entry()
$originEntry = $this->mock(Entry::class);
$originEntry->shouldReceive('id')->andReturn('123');

Facades\Entry::shouldReceive('find')->with('123')->andReturn($originEntry);
$builder = $this->mock(QueryBuilder::class);
$builder->shouldReceive('where')->with('collection', 'test')->andReturnSelf();
$builder->shouldReceive('where')->with('id', 123)->andReturnSelf();
$builder->shouldReceive('first')->andReturn($originEntry);
Facades\Entry::shouldReceive('query')->andReturn($builder);

$originEntry->shouldReceive('values')->andReturn(collect([]));
$originEntry->shouldReceive('blueprint')->andReturn(
$this->mock(Blueprint::class)->shouldReceive('handle')->andReturn('test')->getMock()
Expand Down Expand Up @@ -1805,13 +1811,17 @@ public function the_blueprint_is_not_added_to_the_localized_file_contents()

$originEntry = $this->mock(Entry::class);
$originEntry->shouldReceive('id')->andReturn('123');

Facades\Entry::shouldReceive('find')->with('123')->andReturn($originEntry);
$originEntry->shouldReceive('values')->andReturn(collect([]));
$originEntry->shouldReceive('blueprint')->andReturn(
$this->mock(Blueprint::class)->shouldReceive('handle')->andReturn('another')->getMock()
);

$builder = $this->mock(QueryBuilder::class);
$builder->shouldReceive('where')->with('collection', 'test')->andReturnSelf();
$builder->shouldReceive('where')->with('id', 123)->andReturnSelf();
$builder->shouldReceive('first')->andReturn($originEntry);
Facades\Entry::shouldReceive('query')->andReturn($builder);

$entry = (new Entry)
->collection('test')
->origin('123'); // do not set blueprint.
Expand All @@ -1831,13 +1841,17 @@ public function the_blueprint_is_added_to_the_localized_file_contents_if_explici

$originEntry = $this->mock(Entry::class);
$originEntry->shouldReceive('id')->andReturn('123');

Facades\Entry::shouldReceive('find')->with('123')->andReturn($originEntry);
$originEntry->shouldReceive('values')->andReturn(collect([]));
$originEntry->shouldReceive('blueprint')->andReturn(
$this->mock(Blueprint::class)->shouldReceive('handle')->andReturn('another')->getMock()
);

$builder = $this->mock(QueryBuilder::class);
$builder->shouldReceive('where')->with('collection', 'test')->andReturnSelf();
$builder->shouldReceive('where')->with('id', 123)->andReturnSelf();
$builder->shouldReceive('first')->andReturn($originEntry);
Facades\Entry::shouldReceive('query')->andReturn($builder);

$entry = (new Entry)
->collection('test')
->origin('123')
Expand Down

0 comments on commit 2ac8d5a

Please sign in to comment.