destroyThoroughly => destroyRecursively
This commit is contained in:
parent
f0118b7708
commit
bbe09d1021
11 changed files with 29 additions and 14 deletions
|
|
@ -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'];
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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 %}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ interface ModelInterface
|
|||
|
||||
public function destroy(): int;
|
||||
|
||||
public function destroyThoroughly(): int;
|
||||
public function destroyRecursively(): int;
|
||||
|
||||
public function getListOfProperties(): array;
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
7
test/app/src/Test.php
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
namespace Benzine\ORM\Tests;
|
||||
|
||||
class Test extends App
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue