I don't think you need a Controller class for this.
I suggest you simply create a file
Callback.php
in your add-on's folder which contains something like this:
PHP:
<?php
namespace MyName\MyAddon;
class Callback
{
public static function someAction($size)
{
$data = \XF::app()->finder('MyName\MyAddon:MyClass')->fetchOne();
if($data)
{
$db = \XF::app()->db();
$itemId = ('SELECT id FROM xf_my_table ORDER BY id LIMIT 1');
$db->query("
UPDATE xf_my_table SET itemSize=$size WHERE id=$itemId
")->execute();
}
}
}
Your template code may look like:
HTML:
<xf:callback class="MyName\MyAddon\Callback" method="someAction" params="[1500]" />
In this case your add-on should be inside the folder
src/addons/MyName/MyAddon
(folders and namespace must match).
I never worked with callback inside templates, but I think/hope this code should at least work it's way till it reaches the
someAction()
method inside the
Callback
class.