I Newly Create Joomla Component using Framework on Framework. Administrator Section Working Fine. In Site Section Display Following Error. How to Resolve this Error.
Catchable fatal error: Argument 1 passed to FOFTable::setInput() must
be an instance of FOFInput, instance of F0FInput given, called in
/var/www/testjoomla/libraries/f0f/table/table.php on line 434 and
defined in /var/www/testjoomla/libraries/fof/table/table.php on line
3236
in my Dispatcher code :
include_once JPATH_LIBRARIES.'/fof/include.php';
class GulfJobDispatcher extends FOFDispatcher
{
public function onBeforeDispatch() {
$result = parent::onBeforeDispatch();
if($result) {
// Load Akeeba Strapper
include_once JPATH_ROOT.'/media/akeeba_strapper/strapper.php';
AkeebaStrapper::bootstrap();
AkeebaStrapper::jQueryUI();
AkeebaStrapper::addCSSfile('media://com_gulfjob/css/frontend.css');
}
return $result;
}
}
change F0F to FOF in your Controller or Other Area
Related
I am new to OOP php and took some lessons and now Im trying to practice, I used login with discord method and If user Is logged in the system sould add the discord id to database if user is not already in database but Im facing quite the issue and I have no luck so far to fix It myself, I even asked few of my buddies If they can see the issue but they did not also know the real issue.
My error:
[22-Jul-2022 06:56:00 UTC] PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function
SignupContr::signupUser(), 0 passed in C:\wamp64\www\OOP-Test\inc\signup.inc.php on line 13
and exactly 1 expected in C:\wamp64\www\OOP-Test\classes\signup-contr.class.php:10
Stack trace:
#0 C:\wamp64\www\OOP-Test\inc\signup.inc.php(13): SignupContr->signupUser()
#1 C:\wamp64\www\OOP-Test\dashboard\index.php(12): include('C:\\wamp64\\www\\O...')
#2 {main}
thrown in C:\wamp64\www\OOP-Test\classes\signup-contr.class.php on line 10
My code looks like this right now:
signup.inc.php
{
$discord = $_GET['user'];
include "../classes/dbh.class.php";
include "../classes/signup.class.php";
include "../classes/signup-contr.class.php";
$signup = new SignupContr($discord);
$signup->signupUser();
//header('location: ../dashboard/index.php');
}
signup.class.php
class Signup extends Dbh {
protected function setUser($discord){
$stmt = $this->connect()->prepare("INSERT INTO `users` ('discord') VALUES (?);");
if(!$stmt->execute(array($discord))) {
// $stmt = null;
// header("location: ../dashboard/index.php?useraddfailed");
// exit();
}
$stmt->debugDumpParams();
$stmt = null;
}
}
signup-contr.class.php
class SignupContr extends Signup{
private $discord;
public function _construct($discord){
$this->discord = $discord;
}
public function signupUser(){
$this->setUser($this->discord);
var_dump($this->discord);
}
}
I have not done the check part If user Is allready In the database
I Finally found the issue. I was missing one underscore in construct.
signup.contr.class.php should be like this:
class SignupContr extends Signup{
private $discord;
public function __construct($discord){
$this->discord = $discord;
}
public function signupUser(){
$this->setUser($this->discord);
var_dump($this->discord);
}
}
Of course it was the simplest issue there Is but I really tought there suppost to be only one underscore. You always should check the simple things first, I did not because usally you don't use construct In procedural php
I am transfering my customer and product information to a new install of magento and when importing with CSV im hit with this:
Fatal error: Class 'Mage_Core_Helper_File_Storage' not found in /home/wwwsmkd/public_html/wholesale/app/Mage.php on line 547
This is the code
public static function helper($name)
{
$registryKey = '_helper/' . $name;
if (!self::registry($registryKey)) {
$helperClass = self::getConfig()->getHelperClassName($name);
self::register($registryKey, new $helperClass); // Line 547
}
return self::registry($registryKey);
}
Please check this path
app\code\core\Mage\Core\Helper\File\Storage.php
Does Storage.php file exist or not?
If this file not exist then may be the issue with new magento installation.
Hope this helps you some how.
Everything until now worked perfectly. I'm on page: http://framework.zend.com/manual/current/en/in-depth-guide/understanding-routing.html.
On this page I had to modify 3 files:
-module.config.php
-detail.phtml
-ListController.php
I get the following error:
Post Details
Post Title
Fatal error: Call to a member function getTitle() on null in C:\Program Files\xampp\htdocs\path\to\zf2-tutorial\module\Blog\view\blog\list\detail.phtml on line 6
I didn't paste the code, because it's the same from the link. Can you guys help me figure out my problem?
public function detailAction()
{
$id = $this->params()->fromRoute('id');
try {
$post = $this->postService->findPost($id);
} catch (\InvalidArgumentException $ex) {
return $this->redirect()->toRoute('blog');
}
return new ViewModel(array(
'post' => $post
));
}
Thanks for the update. Now that I see where you are in the tutorial I think you have a problem in the Mapper. See the previous page and chapter Finishing the Mapper
If your mapper cannot find an article it should throw an error as seen in that code example on line 63. Obviously your mapper returns null which causes the error you see Call to a member function getTitle() on null. Because null is not an object after all and doesn't have a getTitle() function.
So have a look at the ZendDbSqlMapper class and the find($id) method and make sure it throws an error if an id isn't found.
I want to test this method:
Class:
public function bind(\Elastica\ResultSet $result = null) {
if (!$result instanceof \Elastica\ResultSet) {
throw new \InvalidArgumentException('I need an instance of \Elastica\ResultSet');
}
$this->bindedData = $result->getResults();
$this->isBinded = true;
}
Test
public function testGetTransformedDataNotSuccesful() {
$this->object->bind(new \stdClass()); //This throws a Catchable fatal error
}
My question is:
How can i test this?
An alternative is not to Type Hint the method var.
Or shouldn't i test this.
Wouldn't it make sense that PHP throws an exception instead of throwing a fatal error ?
Throwing a fatal error is correct, as your method signature explicitly asks for a \Elastica\ResultSet but you provide an \stdClass.
Removing the typehint would also remove the fatal error - but that doesn't make much sense imho :)
edit
This test should pass
public function testGetTransformedDataNotSuccesful() {
$this->setExpectedException(get_class(new PHPUnit_Framework_Error("",0,"",1)));
$this->object->bind(new \stdClass()); //This throws a Catchable fatal error
}
I was receiving the following fatal error, running Joomla 2.5, but only while trying to access the administrative view of a custom component I have created (which accessed the database):
Fatal Error: Cannot access empty property in \libraries\joomla\database\database\mysqli.php on line 498"
The context of line 498 is:
protected function fetchObject($cursor = null, $class = 'stdClass'
{
return mysqli_fetch_object($cursor ? $cursor : $this->cursor, $class);
}
Bizarrely, even after removing the $this->cursor statement like so:
protected function fetchObject($cursor = null, $class = 'stdClass'
{
return mysqli_fetch_object($cursor, $class);
}
I received the same error, despite the fact that that line no longer contains a member access operator.
How could I be receiving this error even though no properties are being accessed in that line?