1<?php
2
3/**
4 * This file is part of the Phalcon Framework.
5 *
6 * (c) Phalcon Team <team@phalcon.io>
7 *
8 * For the full copyright and license information, please view the LICENSE.txt
9 * file that was distributed with this source code.
10 */
11
12namespace Phalcon\Test\Models;
13
14use Phalcon\Mvc\Model;
15
16class GossipRobots extends Model
17{
18    public $trace = [];
19
20    public function initialize()
21    {
22        $this->setSource('robots');
23    }
24
25    public function beforeValidation()
26    {
27        $this->_talk(__METHOD__);
28    }
29
30    protected function _talk(string $completeMethod)
31    {
32        $class  = get_class($this);
33        $method = explode('::', $completeMethod);
34
35        if (!isset($this->trace[$method[1]][$class])) {
36            $this->trace[$method[1]][$class] = 0;
37        }
38
39        $this->trace[$method[1]][$class]++;
40    }
41
42    public function beforeValidationOnUpdate()
43    {
44        $this->_talk(__METHOD__);
45    }
46
47    public function afterValidationOnUpdate()
48    {
49        $this->_talk(__METHOD__);
50    }
51
52    public function validation()
53    {
54        $this->_talk(__METHOD__);
55    }
56
57    public function afterValidation()
58    {
59        $this->_talk(__METHOD__);
60    }
61
62    public function beforeSave()
63    {
64        $this->_talk(__METHOD__);
65    }
66
67    public function beforeUpdate()
68    {
69        $this->_talk(__METHOD__);
70    }
71
72    public function afterUpdate()
73    {
74        $this->_talk(__METHOD__);
75    }
76
77    public function afterSave()
78    {
79        $this->_talk(__METHOD__);
80    }
81
82    public function beforeCreate()
83    {
84        $this->_talk(__METHOD__);
85
86        return false;
87    }
88
89    public function beforeDelete()
90    {
91        $this->_talk(__METHOD__);
92
93        return false;
94    }
95
96    public function notSaved()
97    {
98        $this->_talk(__METHOD__);
99
100        return false;
101    }
102}
103