1: <?php
2: /**
3: * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
4: * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
5: *
6: * Licensed under The MIT License
7: * For full copyright and license information, please see the LICENSE.txt
8: * Redistributions of files must retain the above copyright notice.
9: *
10: * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
11: * @link https://cakephp.org CakePHP(tm) Project
12: * @since 3.0.0
13: * @license https://opensource.org/licenses/mit-license.php MIT License
14: */
15: namespace Cake\ORM\Association;
16:
17: use Cake\Datasource\EntityInterface;
18: use Cake\ORM\Association\DependentDeleteHelper;
19:
20: /**
21: * Implements cascading deletes for dependent associations.
22: *
23: * Included by HasOne and HasMany association classes.
24: *
25: * @deprecated 3.5.0 Unused in CakePHP now. This class will be removed in 4.0.0
26: */
27: trait DependentDeleteTrait
28: {
29:
30: /**
31: * Cascade a delete to remove dependent records.
32: *
33: * This method does nothing if the association is not dependent.
34: *
35: * @param \Cake\Datasource\EntityInterface $entity The entity that started the cascaded delete.
36: * @param array $options The options for the original delete.
37: * @return bool Success.
38: */
39: public function cascadeDelete(EntityInterface $entity, array $options = [])
40: {
41: deprecationWarning(
42: 'The DependentDeleteTrait is deprecated. ' .
43: 'You should use Cake\ORM\Association\DependentDeleteHelper instead.'
44: );
45: $helper = new DependentDeleteHelper();
46:
47: return $helper->cascadeDelete($this, $entity, $options);
48: }
49: }
50: