Re: [Cakephp3] Best way to change database on the fly by user

2016-03-02 Thread rumble
You could bind a database with relation to your app.php and the datasources 
there, and based on param in url or some values in a table, execute in your 
controller:

ConnectionManager::alias($custom_db, 'default');

I am testing similar scenario, but on the model level. 


On Tuesday, February 23, 2016 at 11:20:38 PM UTC, MichaƂ Piotrowski wrote:
>
> Hello !
>
> I used cakephp 3 to implement my apps and it's awesome :)
>
> Now I try to implement datasource by user:
> - one datasource by request
> - every user can use diffrent database
>
>  Now i used vars cache and read it after user login in tables static 
> function defaultConnectionName this solution isn't brilliant but works.
>
> Maybe you can give better solutions.
>
>
>
>

-- 
Sign up for our Newsletter for updates.
http://cakephp.org/newsletter/signup

We will soon be closing this Google Group. But don't worry, we have something 
better coming. Stay tuned for an updated from the CakePHP Team soon.

Like Us on FaceBook https://www.facebook.com/CakePHP
Follow 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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: creating data in foreach loop

2015-10-08 Thread rumble
It should be without:

 $this->request->data['parts']['_ids'][] = $part;


On Thursday, October 8, 2015 at 8:30:04 AM UTC, rumble wrote:
>
> I am trying to save additional data to a jointable, but there is a problem 
> with foreach loop, in which I create all necessary data to be passed and 
> saved. 
>
>   foreach ($this->request->data['Parts']['add_ids'] as $part) {
>
>
>   $this->request->data['parts']['_ids'][] = $part;
>
>
>   $this->request->data['parts'] = array(
>
> 0 => array(
>
> 'id' => $part,
> '_joinData' => array(
>
> 'state' => $state,
> ),
> ),
> );
> }
>
> In this case only the latest one is saved. 
>
> When I change to   $this->request->data['parts'][]
>
> foreach ($this->request->data['Parts']['add_ids'] as $part) {
>
>
>   $this->request->data['parts']['_ids'][] = $part;
>
>
>   $this->request->data['parts'][] = array(
>
> 0 => array(
>
> 'id' => $part,
> '_joinData' => array(
>
> 'state' => $state,
> ),
> ),
> );
> }
>
> Both records are saved but with $state = 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+unsubscr...@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.


creating data in foreach loop

2015-10-08 Thread rumble
I am trying to save additional data to a jointable, but there is a problem 
with foreach loop, in which I create all necessary data to be passed and 
saved. 

  foreach ($this->request->data['Parts']['add_ids'] as $part) {


  $this->request->data['parts']['_ids'][] = $part;


  $this->request->data['parts'] = array(

0 => array(

'id' => $part,
'_joinData' => array(

'state' => $state,
),
),
);
}

In this case only the latest one is saved. 

When I change to   $this->request->data['parts'][]

foreach ($this->request->data['Parts']['add_ids'] as $part) {


  $this->request->data['parts']['_ids'][] = $part;


  $this->request->data['parts'][] = array(

0 => array(

'id' => $part,
'_joinData' => array(

'state' => $state,
),
),
);
}

Both records are saved but with $state = 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+unsubscr...@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 installation in XAMPP

2015-09-14 Thread rumble
1. Download the file with cake (or use composer if you have installed it)
2. Put your folder in place like httdocs or html (depends how it is shipped 
with XAMPP)
3. Start your webserver
4. Open a broswer and go to 127.0.0.1 or localhost
5. Select subfolder (if you didn't place the cake files in the root)
6. debug
 

On Wednesday, September 2, 2015 at 12:23:07 PM UTC, Batman wrote:
>
> Can you please explain me about the installation of cakePHP in xampp on 
> windows 10 briefly?
> Yea I am very new to PHP and also to frameworks. I didnt understand what 
> was given in the cakePHP support forum.
> It would be very much grateful if you can.
> Thanks in 
>

-- 
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+unsubscr...@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.


component vs component's controller

2015-09-14 Thread rumble
Could you briefly explain what is the difference using components vs using 
controllers of the component? 

I cannot understand what should I do in order to use a function I created 
in the controller, which is a part of plugin. 

While I can access the component's functions I don't know how to access 
controllers.

Should it be done by construct and $this->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+unsubscr...@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.


cakephp 3 - how to call controller form plugin

2015-09-14 Thread rumble
I have a controller:

loadComponent('Hello.Hello');
}


And Component:

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+unsubscr...@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 save information from multiple tables at once?

2015-09-14 Thread rumble
If your tables have correct associations, then it would be saved correctly 
by calling 

$this->Table1->Table2->save($data)

I recommend you to take a look at the blog example/tutorial. 



On Thursday, August 13, 2015 at 8:37:34 AM UTC, Weslley Carlos wrote:
>
> Good afternoon. 
> I'm using CakePHP 3 a short time. I'm trying to create a registration 
> application lots.
> In my database, I have two tables that are related: lots and addresses. 
> The table addresses relates to other tables that form the complete register 
> an address (countries, states, etc ..). Using bake at present by signing a 
> new lot, he brings a box on the form to select the id of the address. What 
> I would like is that by signing a new lot, I could make the register of the 
> respective address it together. I've tried to read the documentation, but I 
> can not move. Could someone give me tips which way to go?
>

-- 
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+unsubscr...@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.