destroyThoroughly => destroyRecursively

This commit is contained in:
Greyscale 2020-08-25 14:26:58 +02:00
parent f0118b7708
commit bbe09d1021
11 changed files with 29 additions and 14 deletions

View file

@ -267,6 +267,14 @@ abstract class Model implements ModelInterface, \Serializable
return implode('-', $labelParts);
}
/**
* @deprecated
*/
public function destroyThoroughly(): int
{
return $this->destroyRecursively();
}
protected function getProtectedMethods(): array
{
return ['getPrimaryKeys', 'getProtectedMethods', 'getDIContainer'];

View file

@ -347,7 +347,7 @@ abstract class Base{{ class_name }}Model extends AbstractModel implements ModelI
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function destroyThoroughly(): int
public function destroyRecursively(): int
{
{% if remote_objects.length > 0 %}
$countOfThingsDestroyed = 0;
@ -361,7 +361,7 @@ abstract class Base{{ class_name }}Model extends AbstractModel implements ModelI
if (count($thingsToDestroy) > 0){
foreach($thingsToDestroy as $thingToDestroy){
/** @var $thingToDestroy ModelInterface */
$countOfThingsDestroyed+= $thingToDestroy->destroyThoroughly();
$countOfThingsDestroyed+= $thingToDestroy->destroyRecursively();
}
}
$this->destroy();

View file

@ -213,12 +213,12 @@ class {{ class_name }}Test extends BaseTestCase
/**
* @large
*/
public function testDestroyThoroughly()
public function testdestroyRecursively()
{
/** @var Models\{{ class_name }}Model $destroyableModel */
$destroyableModel = $this->testTableGateway->getNewMockModelInstance();
$destroyableModel->save();
$this->assertGreaterThan(0, $destroyableModel->destroyThoroughly());
$this->assertGreaterThan(0, $destroyableModel->destroyRecursively());
}
{% if related_objects > 0 %}

View file

@ -16,7 +16,7 @@ interface ModelInterface
public function destroy(): int;
public function destroyThoroughly(): int;
public function destroyRecursively(): int;
public function getListOfProperties(): array;

View file

@ -266,7 +266,7 @@ abstract class BaseBlogPostsModel extends AbstractModel implements ModelInterfac
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function destroyThoroughly(): int
public function destroyRecursively(): int
{
return $this->destroy();
}

View file

@ -227,7 +227,7 @@ abstract class BaseMigrationsModel extends AbstractModel implements ModelInterfa
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function destroyThoroughly(): int
public function destroyRecursively(): int
{
return $this->destroy();
}

View file

@ -302,7 +302,7 @@ abstract class BaseUsersModel extends AbstractModel implements ModelInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function destroyThoroughly(): int
public function destroyRecursively(): int
{
return $this->destroy();
}

7
test/app/src/Test.php Normal file
View file

@ -0,0 +1,7 @@
<?php
namespace Benzine\ORM\Tests;
class Test extends App
{
}

View file

@ -175,12 +175,12 @@ class BlogPostsTest extends BaseTestCase
/**
* @large
*/
public function testDestroyThoroughly()
public function testdestroyRecursively()
{
/** @var Models\BlogPostsModel $destroyableModel */
$destroyableModel = $this->testTableGateway->getNewMockModelInstance();
$destroyableModel->save();
$this->assertGreaterThan(0, $destroyableModel->destroyThoroughly());
$this->assertGreaterThan(0, $destroyableModel->destroyRecursively());
}

View file

@ -158,12 +158,12 @@ class MigrationsTest extends BaseTestCase
/**
* @large
*/
public function testDestroyThoroughly()
public function testdestroyRecursively()
{
/** @var Models\MigrationsModel $destroyableModel */
$destroyableModel = $this->testTableGateway->getNewMockModelInstance();
$destroyableModel->save();
$this->assertGreaterThan(0, $destroyableModel->destroyThoroughly());
$this->assertGreaterThan(0, $destroyableModel->destroyRecursively());
}
public function testGetPropertyMeta()

View file

@ -168,12 +168,12 @@ class UsersTest extends BaseTestCase
/**
* @large
*/
public function testDestroyThoroughly()
public function testdestroyRecursively()
{
/** @var Models\UsersModel $destroyableModel */
$destroyableModel = $this->testTableGateway->getNewMockModelInstance();
$destroyableModel->save();
$this->assertGreaterThan(0, $destroyableModel->destroyThoroughly());
$this->assertGreaterThan(0, $destroyableModel->destroyRecursively());
}
/**