1 | <?php |
||
43 | class LinkBehavior extends Behavior |
||
44 | { |
||
45 | |||
46 | /** |
||
47 | * @var string The name of default action for the model, usually view |
||
48 | */ |
||
49 | public $defaultAction = 'view'; |
||
50 | |||
51 | /** |
||
52 | * @var string The name of the controller to be used in links |
||
53 | */ |
||
54 | public $moduleName; |
||
55 | |||
56 | /** |
||
57 | * @var string The name of the controller to be used in links |
||
58 | */ |
||
59 | private $_controllerName; |
||
60 | |||
61 | /** |
||
62 | * Gets the name of the controller to be used in links |
||
63 | * |
||
64 | * @return string |
||
65 | */ |
||
66 | public function getControllerName() |
||
72 | |||
73 | /** |
||
74 | * Sets the name of the controller to be used in links |
||
75 | * |
||
76 | * @param $controllerName |
||
77 | */ |
||
78 | public function setControllerName($controllerName) |
||
82 | |||
83 | /** |
||
84 | * The name of this model to be used in titles |
||
85 | * |
||
86 | * @return string |
||
87 | */ |
||
88 | public function getLinkText() |
||
92 | |||
93 | /** |
||
94 | * Returns a URL Array to the model |
||
95 | * |
||
96 | * @param string $action |
||
97 | * @param array $params |
||
98 | * @return array |
||
99 | */ |
||
100 | public function getUrl($action = null, $params = []) |
||
109 | |||
110 | /** |
||
111 | * Returns a Link to the model |
||
112 | * |
||
113 | * @param string $title |
||
114 | * @param string $action |
||
115 | * @param array $params |
||
116 | * @param array $options |
||
117 | * @return string |
||
118 | */ |
||
119 | public function getLink($title = null, $action = null, $params = [], $options = []) |
||
125 | |||
126 | /** |
||
127 | * Returns Primary Key as a string |
||
128 | * |
||
129 | * @return string |
||
130 | */ |
||
131 | public function getPrimaryKeyString() |
||
137 | |||
138 | } |
||
139 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: