Wednesday, June 3, 2015

Re: How to write a query | cakephp 3.x

Of course I tasted. However, the working version was never found. Here's my attempt:

Variant 1:
             $result = $this->Models->find()
                               
->where(function ($exp) {
                                       $notz
= $exp->or_(['kw LIKE' => $word_7])
                                                   
->eq('kw LIKE', $word_8)
                                                   
->eq('kw LIKE', $word_9);
                                       $and
= $exp->and_(['kw LIKE' => $word_1])
                                                   
->eq('kw LIKE', $word_2)
                                                   
->eq('kw LIKE', $word_3);
                                       $and2
= $exp->and_(['kw LIKE' => $word_4])
                                                   
->eq('kw LIKE', $word_5)
                                                   
->eq('kw LIKE', $word_6);


                               
return $exp->add($and)                                      
                                       
->add($and2)
                                       
->not($notz);
                               
});


Variant 2:
            $result = $this->Models->find()
               
->where([
                   
'OR' => [
                       
['AND' => [['kw LIKE' => $word_1],['kw LIKE' => $word_2],['kw LIKE' => $word_3]]],
                       
['AND' => [['kw LIKE' => $word_4],['kw LIKE' => $word_5],['kw LIKE' => $word_6]]]],
                   
['NOT' => [['kw LIKE' => $word_7],['kw LIKE' => $word_8],['kw LIKE' => $word_9]]]
               
]);


четверг, 4 июня 2015 г., 1:42:04 UTC+5 пользователь José Lorenzo написал:
What have you tried so far? Did you read the documentation on creating queries in cake 3?

On Wednesday, June 3, 2015 at 7:58:44 AM UTC+2, InYan wrote:
in cakephp v.1.3.x I used $this->Model->query($q);

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Re: How to write a query | cakephp 3.x

What have you tried so far? Did you read the documentation on creating queries in cake 3?

On Wednesday, June 3, 2015 at 7:58:44 AM UTC+2, InYan wrote:
in cakephp v.1.3.x I used $this->Model->query($q);

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Re: cakephp best practice

If you are just looking to make it easier for them to find an option in a large list, I would implement something like https://select2.github.io/ (see the remote data section in the examples if you have too many sales groups to pre-populate the list on page load)

If the user needs to fill out multiple fields tin order to perform a more advanced search then it would depend on the overall user experience you want to deliver - revealing a form in the page or via a modal is definitely a viable ui pattern.



On Tuesday, June 2, 2015 at 3:18:19 PM UTC-4, Elton Antunes wrote:
Hi there,

I'm new to web development and I've been studying cakephp and I have this situation where I want to know the best practice.

Imagine a user creating a new Customer in the application, in the form he has to choose the customer's sales group, and this table has so many records, that's using a drop down list isn't a viable option.

I was thinking in the user press a button, then open a modal window. This new window would have a grid, with search options (for filtering the data) and the user would choose one, and go back to the original form, bringing back the sales group selected by the user.

What's the name of this technique, and is it a good option? How to do this in cakephp?

Best regards

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Tuesday, June 2, 2015

Re: How to write a query | cakephp 3.x

in cakephp v.1.3.x I used $this->Model->query($q);

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

How to write a query | cakephp 3.x

Please help!
How to write a query to the database according to the conventions cakephp 3.x
SELECT * FROM keywords
WHERE
(kw LIKE %{$word_1}% AND kw LIKE %{$word_2}% AND kw LIKE %{$word_3}%)
 OR
(kw LIKE %{$word_4}% AND kw LIKE %{$word_5}% AND kw LIKE %{$word_6}%)
 NOT
(kw LIKE %{$word_7}% AND kw LIKE %{$word_8}% AND kw LIKE %{$word_9}%)
ORDER BY frequency DESC
;


Important! Any variable ($word_1 - $word_9) can be NULL

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

NewBie

what is the difference between $this->request and $request->

do both convey same information

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Re: Cake 3 - Modelless Forms with nested forms / elements

Hi Karthik,

I don't know how your answer should solve my problem. Maybe I didn't explain it enoug.
I would like to have a Form, where I can fill in multiple Phonenumbers and I don't know bevor hand
how many phone numbers there will be. After receiving the data from the user I want to validate
the phonenumber,

regards
Dieter


Am Montag, 1. Juni 2015 16:04:02 UTC+2 schrieb Karthik Keyan:


Hi, Create the form name in /src/UserForm1.php
namespace App\Form;

use Cake\Form\Form;
use Cake\Validation\Validator;

class UserForm1 extends Form {

    protected function _buildValidator(Validator $validator) {
        return $validator
                        ->notEmpty('annul_income', 'please enter the Annual income')
                        ->add('annul_income', 'annul_income number should be numeric', ['rule' => 'numeric'])

                        ->notEmpty('terms', 'You must accept our terms of service')
                        ->add('terms', [
                            'equalTo' => [
                                'rule' => ['equalTo', '1'],
                                'message' => 'You must accept our terms of service'
                            ]
                        ]);
    }

    public function setErrors($errors) {
        $this->_errors = $errors;
    }

}
In Controller File:
-------------------------
        $rate = new UserForm1();
 
      $this->set(compact('rate'));
Don't forgot to add use App\Form\UserForm1;
Top of the controller


--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.