EzDevInfo.com

cakephp

CakePHP: The Rapid Development Framework for PHP - Official Repository CakePHP v3.0 - the rapid development php framework.

CakePHP: Find where field is not null

I need to select all rows where User.site_url is not null. It's simple enough to do this in a regular MySQL query but how is this done in CakePHP?

The manual mentions the following:

array ("not" => array (
        "Post.title" => null
    )
)

I have tried the following but it's still returning everything

$this->User->find('all', array('conditions' => array('not' => array('User.site_url'))));

Source: (StackOverflow)

To Use a PHP Framework or Not? [closed]

I've started writing a few applications in PHP, and I'm becoming more familiar with the language. Someone told me about CakePHP, and CodeIgniter. I wanted to get a better understanding of how these could help me, and whether it's worthwhile spending the time to learn a framework?


Source: (StackOverflow)

Advertisements

How to get complete current url for Cakephp

How do you echo out current URL in Cake's view?


Source: (StackOverflow)

CakePHP - get last query run

I want to get the last query CakePHP ran. I can't turn debug on in core.php and I can't run the code locally. I need a way to get the last sql query and log it to the error log without effecting the live site. This query is failing but is being run.

something like this would be great:

$this->log($this->ModelName->lastQuery);

Thanks in advance.


Source: (StackOverflow)

Is PHP Object-oriented?

Is PHP an object-oriented language? If not, then what about the framework CakePHP? Is it an object-oriented MVC implementation of PHP?

Also, can a PHP application wholly built using classes be called object-oriented?


Source: (StackOverflow)

CentOS: Enabling GD Support in PHP Installation

How do I go about enabling GD Support in a CentOS Installation?


Source: (StackOverflow)

"[notice] child pid XXXX exit signal Segmentation fault (11)" in apache error.log [closed]

I am using Apache/PHP/MySQL stack.
Using as framework CakePHP.

Every now and then I get a blank white page. I can't debug it through Cake, so I peek in the apache error.log and here's what I get:

[Wed Oct 12 15:27:23 2011] [notice] child pid 3580 exit signal Segmentation fault (11)
[Wed Oct 12 15:27:34 2011] [notice] child pid 3581 exit signal Segmentation fault (11)
[Wed Oct 12 15:30:52 2011] [notice] child pid 3549 exit signal Segmentation fault (11)
[Wed Oct 12 16:04:27 2011] [notice] child pid 3579 exit signal Segmentation fault (11)
zend_mm_heap corrupted
[Wed Oct 12 16:26:24 2011] [notice] child pid 3625 exit signal Segmentation fault (11)
[Wed Oct 12 17:57:24 2011] [notice] child pid 3577 exit signal Segmentation fault (11)
[Wed Oct 12 17:58:54 2011] [notice] child pid 3550 exit signal Segmentation fault (11)
[Wed Oct 12 17:59:52 2011] [notice] child pid 3578 exit signal Segmentation fault (11)
[Wed Oct 12 18:01:38 2011] [notice] child pid 3683 exit signal Segmentation fault (11)
[Wed Oct 12 22:20:53 2011] [notice] child pid 3778 exit signal Segmentation fault (11)
[Wed Oct 12 22:29:51 2011] [notice] child pid 3777 exit signal Segmentation fault (11)
[Wed Oct 12 22:33:42 2011] [notice] child pid 3774 exit signal Segmentation fault (11)

What is this segmentation fault, how can I fix this, I have no clue and would be greatfully greatful.

UPDATE:

PHP Version 5.3.4, OSX local development
Server version: Apache/2.2.17 (Unix)
CakePhp: 1.3.10

Source: (StackOverflow)

How can I see CakePHP's SQL dump in the controller?

Is there a way that one can cause CakePHP to dump its SQL log on demand? I'd like to execute code up until a point in my controller and see what SQL has been run.


Source: (StackOverflow)

Can I use one model inside of a different model in CakePHP?

Can I use another Model inside one model?

Eg.

<?php
class Form extends AppModel
{
    var $name='Form';
    var $helpers=array('Html','Ajax','Javascript','Form');
    var $components = array( 'RequestHandler','Email');

    function saveFormName($data)
    {
        $this->data['Form']['formname']=$data['Form']['formname'];
        $this->saveField('name',$this->data['Form']['formname']);
    } 

    function saveFieldname($data)
    {
        $this->data['Attribute']['fieldname']=$data['Attribute']['fieldname'];
    }

}
?>

Source: (StackOverflow)

symfony vs cakephp [closed]

What is conceptually the difference between symfony and cakephp?


Source: (StackOverflow)

Xdebug and No Profiling Output

This is a similar problem to XDebug profiling in PHP - can't get output but mine is on windows and I have the full path specified (which solved his problem)

I am not getting any output even though I have enabled the profiler. Below is a copy of xdebug setup (I have indented all the options that have been uncommented.) - Please note that xdebug is working fine as Ii have been getting the standard xdebug errors. If it make any difference I am using xampp, cakephp, php 5.3

Any help would be greatly appreciated.

[XDebug]
zend_extension = "C:\xampp\php\ext\php_xdebug.dll"

;xdebug.auto_trace = 0
;xdebug.collect_includes = 1
;xdebug.collect_params = 0
;xdebug.collect_return = 0
;xdebug.collect_vars = "Off"
;xdebug.default_enable = "On"
;xdebug.dump.SERVER = REMOTE_ADDR,REQUEST_METHOD
;xdebug.dump.SERVER = REMOTE_ADDR,REQUEST_METHOD
;xdebug.dump.COOKIE = ""
;xdebug.dump.FILES = ""
;xdebug.dump.GET = ""
;xdebug.dump.POST = ""
;xdebug.dump.REQUEST = ""
;xdebug.dump.SERVER = ""
;xdebug.dump.SESSION = ""
;xdebug.dump_globals = 1
;xdebug.dump_once = 1
;xdebug.dump_undefined = 0
;xdebug.extended_info = 1
;xdebug.file_link_format = ""
;xdebug.idekey = ""
;xdebug.manual_url = "http://www.php.net"
;xdebug.max_nesting_level = 100
;xdebug.overload_var_dump = 1
    xdebug.profiler_append = 0
    xdebug.profiler_enable = 1
    xdebug.profiler_enable_trigger = 0
    xdebug.profiler_output_dir = "C:\xampp\tmp"
    xdebug.profiler_output_name = "xdebug_profile.%R::%u"
;xdebug.remote_autostart = 0
    xdebug.remote_enable = 0
    xdebug.remote_handler = "dbgp"
    xdebug.remote_host = "127.0.0.1"
;xdebug.remote_log = "none"
;xdebug.remote_mode = "req"
    xdebug.remote_port = 9000
;xdebug.show_exception_trace = 0
;xdebug.show_local_vars = 0
;xdebug.show_mem_delta = 0
;xdebug.trace_format = 0
;xdebug.trace_options = 0
    xdebug.trace_output_dir = "C:\xampp\tmp"
;xdebug.trace_output_name = "trace.%c"
;xdebug.var_display_max_children = 128
;xdebug.var_display_max_data = 512
;xdebug.var_display_max_depth = 3

Source: (StackOverflow)

CakePHP 2.0 with Twitter Bootstrap

Is there a way to configure CakePHP for it to work well with Twitter Bootstrap? I realize this question has already been asked here, but the answer wasn't really complete.

There are also quite a few tutorials out there, but they are all either outdated or just not working, example: Build a PHP application using CakePHP and (twitter) Bootstrap, Part 1.

Thanks!


Source: (StackOverflow)

CakePHP: best way to call an action of another controller with array as parameter?

In a controller, what is the most appropriate way to call the action of another controller and also pass an array as parameter?

I know that you can use requestAction to call actions within other controllers. But is it possible to pass arrays as parameters using request action?

And no, I do not want to put the action in the App Controller. So that is not a solution for me.

The only other way I know is to load the other controller as explained in: http://book.cakephp.org/1.3/en/The-Manual/Developing-with-CakePHP/Configuration.html#importing-controllers-models-components-behaviors-views-and-helpers

But is there an easier way to just call the other controllers action while passing an array as parameter?

I am new to cakePHP so any suggestion is appreciated. Thanks.


Source: (StackOverflow)

php e() and h() functions?

I and lately I'm seeing h() and e() functions in php... I have googled them, but they are so short that results doesn't give any idea of what they are. I got results like exponential, or math related functions.

for example:

<td><?php echo h($room['Room']['message']) ?></td>

Does any one has an idea? or maybe they are not called functions? (I think I read about that very long ago, but I can remember its real name)

ADDED: Thanks, for the replies. I am using cakephp and also found an e() example:

<?php e($time->niceShort($question['Question'] ['created'])) ?>

If they were escaping somehow strings I think it would make sense, since I always see them right next the "echo"

I still don't know what they are ;(


Source: (StackOverflow)

Using CakePHP FormHelper with Bootstrap Forms

CakePHP's FormHelper is how you generate forms when making CakePHP applications. As one might assume, this includes generating input elements, like so:

$this->Form->input('abc');

Which will produce HTML something like this:

<div class="input text">
  <label for="ModelAbc">Abc</label>
  <input name="data[Model][Abc]" class="" maxlength="250" type="text" id="ModelAbc">
</div>

Now, sadly, Bootstrap wants something like the following:

<div class="control-group">
  <label for="ModelAbc" class="control-label">Abc</label>
  <div class="controls">
    <input name="data[Model][Abc]" class="" maxlength="250" type="text" id="ModelAbc">
  </div>
</div>

How do I make CakePHP produce this output?


Source: (StackOverflow)