Dannymh
Active member
Hi,
I am working on extending a 3rd party plugin. I am fine with that in most cases, because I can simply add the additional things I need, However in this one there is a controller class that essentially sends information to a model, I want to extend this method, however the method has variables/params in it so when i try to extend it I get an incompatibility error, the original code looks like
I am trying to extend this and I get to the point of my method being called. If I try to parse the same paramaters i get the following error
If I try to extend the method without the params I get the following error
Essentially I still want those params passed into my code because I have additional things inside the Game and picks array.
I tried bringing in the parent::actionUpdate() but because the last action out of that is a redirect it inherits that as its data
I just cant figure out how I can achieve this.
Dan
I am working on extending a 3rd party plugin. I am fine with that in most cases, because I can simply add the additional things I need, However in this one there is a controller class that essentially sends information to a model, I want to extend this method, however the method has variables/params in it so when i try to extend it I get an incompatibility error, the original code looks like
PHP:
public function updatePicks(array $games, array $picks, $userId, $poolId, $weekId, array $ascores, array $hscores)
{
$visitorId = XenForo_Visitor::getUserId();
if ($visitorId == $userId)
{
for($i=0; $i<count($games); $i++) {
$g = $games[$i];
$p = $picks[$i];
$hs = $hscores[$i];
$as = $ascores[$i];
$pick = $this->_getDb()->fetchRow('
SELECT *
FROM xf_nflj_pickem_pick
WHERE user_id = ?
AND game_id = ?
', array($userId, $g));
$writer = XenForo_DataWriter::create('NFLJ_Pickem_DataWriter_Pick');
if ($pick)
{
$writer->setExistingData($pick['pick_id']);
}
$writer->set('user_id', $userId);
$writer->set('pool_id', $poolId);
$writer->set('week_id', $weekId);
$writer->set('game_id', $g);
$writer->set('team_id', $p);
$writer->set('ascoreary', $as);
$writer->set('hscoreary', $hs);
$writer->save();
}
}
}
I am trying to extend this and I get to the point of my method being called. If I try to parse the same paramaters i get the following error
Code:
Declaration of Silvertails_PickemImporter_Model_BonusFE::updatePicks() should be compatible with NFLJ_Pickem_Model_Picks::updatePicks(array $games, array $picks, $userId, $poolId, $seasonId, $weekId)
[LIST=1]
[*]XenForo_Application::handlePhpError() in XenForo/Autoloader.php at line 119
[*]XenForo_Autoloader::autoload() in XenForo/Autoloader.php at line 119
[*]XenForo_Autoloader->autoload() in XenForo/Application.php at line 1050
[*]XenForo_Application::autoload() in XenForo/Application.php at line 529
[*]XenForo_Application::resolveDynamicClass() in XenForo/Model.php at line 189
[*]XenForo_Model::create() in XenForo/Controller.php at line 101
[*]XenForo_Controller->getModelFromCache() in NFLJ/Pickem/ControllerPublic/Picks.php at line 248
[*]NFLJ_Pickem_ControllerPublic_Picks->_getPKMPicksModel() in NFLJ/Pickem/ControllerPublic/Picks.php at line 97
[*]NFLJ_Pickem_ControllerPublic_Picks->actionEdit() in XenForo/FrontController.php at line 351
[*]XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 134
[*]XenForo_FrontController->run() in /home/silvert/public_html/index.php at line 13
[/LIST]
If I try to extend the method without the params I get the following error
Code:
Declaration of Silvertails_PickemImporter_Model_BonusFE::updatePicks() should be compatible with NFLJ_Pickem_Model_Picks::updatePicks(array $games, array $picks, $userId, $poolId, $seasonId, $weekId)
[LIST=1]
[*]XenForo_Application::handlePhpError() in XenForo/Autoloader.php at line 119
[*]XenForo_Autoloader::autoload() in XenForo/Autoloader.php at line 119
[*]XenForo_Autoloader->autoload() in XenForo/Application.php at line 1050
[*]XenForo_Application::autoload() in XenForo/Application.php at line 529
[*]XenForo_Application::resolveDynamicClass() in XenForo/Model.php at line 189
[*]XenForo_Model::create() in XenForo/Controller.php at line 101
[*]XenForo_Controller->getModelFromCache() in NFLJ/Pickem/ControllerPublic/Picks.php at line 248
[*]NFLJ_Pickem_ControllerPublic_Picks->_getPKMPicksModel() in NFLJ/Pickem/ControllerPublic/Picks.php at line 97
[*]NFLJ_Pickem_ControllerPublic_Picks->actionEdit() in XenForo/FrontController.php at line 351
[*]XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 134
[*]XenForo_FrontController->run() in /home/silvert/public_html/index.php at line 13
[/LIST]
Essentially I still want those params passed into my code because I have additional things inside the Game and picks array.
I tried bringing in the parent::actionUpdate() but because the last action out of that is a redirect it inherits that as its data
I just cant figure out how I can achieve this.
Dan