I would like to read from the sessions table and display on a page in CakePHP. I can load the CakeSession model easy enough and even do a read on it, which works.
But when I do a find:
$sessions = $this->CakeSession->find('all');
I get this error:
Error: Call to undefined method CakeSession::find()
Any ideas on how to do a find on that model?
I created a model and it works, and didn't break anything else. Thanks for your help scrawler and dhofstet!
Related
I am correctly retrieving my data form Parse, however when trying to call the function getCreatedAt it doesn't work.
I am correctly retrieving other info like this:
$obj->get(' description');
But when calling getCreatedAt the page doesn't work and throws this error:
__toString() must not throw an exception
I have tried getting the timestamp like this
$obj->get('createdAt');
$obj->getCreatedAt();
But none worked.
Does anyone know what may be going on?
Found the solution.
I am using laravel and I was trying to print the Datetime which is not possible, as it is an object.
Instead of calling
{{$obj->getCreatedAt()}}
You can just call
{{$obj->getCreatedAt()->format('Y-m-d H:i:s')}}
Thanks for your answers!
My question is what exactly is this error message telling me? What do I need to do specifically?
Fatal error: Call to a member function sql_in_set() on a non-object in /home/savas/x/inc/recenttopicsfeed.php on line 15
I have a php page pulling users and info from a phpbb3 forum. I decided to add a recent topics side bar on the same page and use the code from elsewhere so it's not mine and I don't fully understand it. I get this error message.
I tried looking and can't figure it out, but so I guess I want to understand fully what this means to better try and solve it.
Thank you.
This error messages is explaining itself by saying that sql_in_set is being called on non object.
If you are familiar with OOPS concepts then you must know that whenever we are going to call some member functions of class, we have to do it through class objects.
e.g: $db=new Database();
$db->member_function();
In this example we are calling member_function by object $db of Database class.
As you have mentioned that you are using it phpbb3 form and copying code from somewhere else.
I suppose you are doing it something like:
$sql = 'SELECT * FROM ' . USERS_TABLE . ' WHERE ' . $db->sql_in_set('user_id', $sql_in);
as explained here: https://wiki.phpbb.com/Dbal.sql_in_set
So i suppose you are using it somewhere where $db is not accessible/not created yet.
Try understanding the flow of phpbb3 and pass variables according to it.
I am creating a Symfony2 application, all works well, but when i try to execute my behat tests or clear the cache, i got this error:
Error: Call to undefined method
Symfony\Bundle\FrameworkBundle\Templating\Loader\TemplateLocator::isFresh() in
[...]/vendor/symfony/assetic-
bundle/Symfony/Bundle/AsseticBundle/Factory/Resource/FileResource.php line 49
TemplateLocator does not even implements LoaderInterface, as required in FileResource construct.
Anyone has a clue ?
I figured out where the problem came from, but without understanding it.
It appeared that somewhere in my application I called
$this->container->get('twig')->render("Bundle:View:action.html.twig")
I changed to
$this->container->get('templating')->render("Bundle:View:action.html.twig")
twig service is a Twig_Environment instance, and template is a DelegatingEngine instance, both allowing to render a template.
And all works great again.
If someone could explain me what happened, I'll appreciate :)
i am working on an website on kohana 3.0.12 and i have installed a module that loggs me some errors. All works fine, except that, when i want to effectively log an error, i get an error and i don;t know how to manage it.
Here is the messy code:
public static function handler(Exception $e)
{
// It's a nice time to log :)
Kohana::$log->add(Kohana::ERROR, Kohana_Exception::text($e));
etc code here
well that Kohana_Exception::text($e) causes an exception like: Call to undefined method Kohana_Exception::text() ? i guess it is a framework bug. any idea of how i can solve the problem? (i guess i should use another instance but Kohana_Exception:: but what instance?)
thank you
You get this error because neither Kohana_Exception nor Exception classes don't have text() method. I think the author of the module wanted to write like this:
Kohana::$log->add(Kohana::ERROR, Kohana::exception_text($e));
I belive the exception handling in 3.0 is located in the Kohana class. Try Kohana::exception(), or look in api guide if that isn't it.
I am trying to make a service call to a php function from flex, through Zend AMF. Most of the functions get called fine, but for one particular function, it throws the following exception:
InvocationTargetException:There was an
error while invoking the operation.
Check your operation inputs or server
code and try invoking the operation
again.
Reason: Fatal error: Call to a member
function getInvokeArguments() on a
non-object in
D:\wamp\www\ZendFramework\library\Zend\Amf\Server.php
on line 328
I am not able to debug through this - has anyone faced any issue like this before, or have any ideas how this can be debugged?
At a quick glance through ZFW's source, this appears to be a bug on their framework.
// There is no check if $this->_table[$qualifiedName] is an object, implements an interface, extends a class, only if it's set (the key exists).
$info = $this->_table[$qualifiedName];
$argv = $info->getInvokeArguments(); // Here's when you get the error.
Source: http://framework.zend.com/code/filedetails.php?repname=Zend+Framework&path=/trunk/library/Zend/Amf/Server.php
I looked in their bug tracker and haven't found anything related to this, perhaps you should open a new issue?
Additionally, you can debug the problem by grabbing the message that Flex is sending to the PHP client and making a test case out of it.
We finally realized that this was a problem in the flex project setup - don't know exactly what it was, but once we deleted and created the project again, things started working fine!