Re: Security and Ajax

2013-08-08 Thread Jeremy Burns : Class Outfit
Because the keys are 'use once', so when submitted by ajax become invalid. See 
this page for a solution: 
http://book.cakephp.org/2.0/en/core-libraries/components/security-component.html#SecurityComponent::$csrfUseOnce

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 8 Aug 2013, at 20:53, "Advantage+"  wrote:

> I know forms submitted via ajax that the security component does not work. 
> (Checking for edits / tampering)
>  
> What is the reason for this? I understand if you add fields dynamically why 
> it would not work because of the hashed fields when the form is rendered.
>  
> But if you are simply sending a form as coded $this->Form as standard 
> procedure, no edits or fields added why would it not act the same?
> The exact data is being sent as if it was submitted http. No?
>  
> Just curious.
>  
> Thanks,
>  
> Dave
>  
> 
> -- 
> 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/groups/opt_out.
>  
>  

-- 
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/groups/opt_out.




Complex query not possible using Cakephp?

2013-08-08 Thread Pablito Pablito
Hello everyone,

I have a complex query for summarizing data that looks like:

$sql = 'SELECT
  severity,
  SUM( IF( c.name = "ABC", 1, 0 ) ) AS 
"ABC",
  SUM( IF( c.name = "XYZ", 1, 0 ) ) AS 
"XYZ",
FROM events s
INNER JOIN classes 
c ON c.id = s.class_id
group by severity
with rollup'


it generates partial totals for a list of items using row values, the query 
works perfect on the terminal.

The issue I'm having is that Cake's query() is overwritting results, I was 
trying to run a direct query using:

$db =& ConnectionManager::getDataSource('dbc');
$result = mysql_query($sql, $db->_connection ); 

but _connection() is protected.

Is there a way to override all of Cake's objects and just call 
mysql_query() / mysql_fetch_assoc() ? 


p.s.: this is just for some complex reports I have to build, for the rest 
I'm using cake's great Model objects :)

-- 
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/groups/opt_out.




Security and Ajax

2013-08-08 Thread Advantage+
I know forms submitted via ajax that the security component does not work.
(Checking for edits / tampering)

 

What is the reason for this? I understand if you add fields dynamically why
it would not work because of the hashed fields when the form is rendered.

 

But if you are simply sending a form as coded $this->Form as standard
procedure, no edits or fields added why would it not act the same? 

The exact data is being sent as if it was submitted http. No?

 

Just curious.

 

Thanks,

 

Dave 

 

-- 
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/groups/opt_out.




Re: question about recursive

2013-08-08 Thread Хамит Рахимкулов
thx you a lot!!))
that was realy stupit problem
i read that section, but didn't see the answer

-- 
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/groups/opt_out.




RE: question about recursive

2013-08-08 Thread Advantage+
Category model assuming Category hasMany Type :

 

public $hasMany = array(

'Type' => array(

'className' => 'Type',

'order' => 'Type.order ASC'  //DESC depending on how
you want them ordered

)

);

 

 

Check the section on linking models together with all the various options.

http://book.cakephp.org/2.0/en/models/associations-linking-models-together.h
tml

 

Dave

 

From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
Of ? ??
Sent: Thursday, August 08, 2013 3:01 PM
To: cake-php@googlegroups.com
Subject: question about recursive

 

I'm new with cake php, but i have a problem that i can't fix...

 

Can i somehow sort data that gets by this attribute?

i'm getting that array

array(
(int) 0 => array(
   'Category' => array(
   'id' => '3',
   'name' => 'Материал',
   'order' => '1'
   ),
'Type' => array(
   (int) 0 => array(
   'id' => '4',
   'categorie_id' => '3',
   'name' => 'дерево',
   'order' => '3'
   ),
   (int) 1 => array(
   'id' => '5',
   'categorie_id' => '3',
   'name' => 'пвх',
   'order' => '2'
   ),
   (int) 2 => array(
   'id' => '6',
   'categorie_id' => '3',
   'name' => 'шпон',
   'order' => '1'
   )
   )
),
(int) 1 => array(
   'Category' => array(
  .
so the question is - can i sort 'Type' array by the field 'order'?

-- 
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/groups/opt_out.
 
 

-- 
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/groups/opt_out.




Re: configure subdomains with cakephp

2013-08-08 Thread euromark
seems to me like you are modifying the wrong htaccess file
the relevant one is the one in the webroot dir.


Am Mittwoch, 22. August 2012 21:04:15 UTC+2 schrieb Ogalav:
>
> I am creating a subdomain chat.sitio.com 
>
> but I do not understand why the error occurs internarl 
>
> I've been checking the htaccess and it seems I have to put in 
> the. htaccess directory the sigueinte chat lines to choose not 
> by rewrite 
>
>  
> RewriteEngine off 
>  
>
> but still not working .. 
> someone could guide me if I have to put a line in the 
> htaccess in the site root cake 
>
>  
> RewriteEngine on 
> RewriteRule ^ $ app / webroot / [L] 
> RewriteRule (. *) App / webroot / $ 1 [L] 
>  
>
> I hope I can help 
>
> thanks 
>
> 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+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/groups/opt_out.




question about recursive

2013-08-08 Thread Хамит Рахимкулов
I'm new with cake php, but i have a problem that i can't fix...

Can i somehow sort data that gets by this attribute?
i'm getting that array

*array(
(int) 0 => array(
'Category' => array(
'id' => '3',
'name' => 'Материал',
'order' => '1'
),
'Type' => array(
(int) 0 => array(
'id' => '4',
'categorie_id' => '3',
'name' => 'дерево',
'order' => '3'
),
(int) 1 => array(
'id' => '5',
'categorie_id' => '3',
'name' => 'пвх',
'order' => '2'
),
(int) 2 => array(
'id' => '6',
'categorie_id' => '3',
'name' => 'шпон',
'order' => '1'
)
)
),
(int) 1 => array(
'Category' => array(*
.

so the question is - can i sort '*Type*' array by the field '*order*'?

-- 
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/groups/opt_out.




Re: after div closing tag form ends

2013-08-08 Thread Simon Males
Put the following just before the end() call?

Form->submit('Save'); ?>

On Wed, Aug 7, 2013 at 6:40 PM, mreza_golestan  wrote:
> echo $this->Form->create('Page');
> echo $this->Form->input('slug');
> echo $this->Form->input('title');
> echo $this->Form->input('content');
> ؟>
> 
>
>  echo $this->Form->input('view_show');
> echo $this->Form->end('Save');
> ?>
>
>
> in the above code view_shop field and Submit button is not in the form
> because formhelper close the form when see 
>
>
>
>
>
>
> --
> View this message in context: 
> http://cakephp.1045679.n5.nabble.com/after-div-closing-tag-form-ends-tp5715990p5715998.html
> Sent from the CakePHP mailing list archive at Nabble.com.
>
> --
> 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/groups/opt_out.



-- 
Simon Males

-- 
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/groups/opt_out.




Re: configure subdomains with cakephp

2013-08-08 Thread naresh . b
Add like this in .htaccess file of root directory


RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?domain.com$
RewriteRule^$ app/webroot/[L]
RewriteCond %{HTTP_HOST} ^(www\.)?domain.com$
RewriteRule(.*) app/webroot/$1 [L]


it will work...if you need  further help contact me via 
naresh@gmail.com

On Thursday, August 23, 2012 12:34:15 AM UTC+5:30, Ogalav wrote:
>
> I am creating a subdomain chat.sitio.com 
>
> but I do not understand why the error occurs internarl 
>
> I've been checking the htaccess and it seems I have to put in 
> the. htaccess directory the sigueinte chat lines to choose not 
> by rewrite 
>
>  
> RewriteEngine off 
>  
>
> but still not working .. 
> someone could guide me if I have to put a line in the 
> htaccess in the site root cake 
>
>  
> RewriteEngine on 
> RewriteRule ^ $ app / webroot / [L] 
> RewriteRule (. *) App / webroot / $ 1 [L] 
>  
>
> I hope I can help 
>
> thanks 
>
> 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+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/groups/opt_out.




Re: Problem with save method

2013-08-08 Thread Andras Kende


$this->request->data['Event]['image] = false;
OR
unset($this->request->data['Event]['image]);

$this->Event->save($this->request->data);

Andras Kende


On Aug 7, 2013, at 6:01 AM, kapil agrawal  wrote:

> Hi!
> 
> I am a new bee in cakePHP, look at following scenario
> 
> I have following tables structure
> 
> ---
> Table name: events
> Field TypeNullDefault Comments
> idint(11) No  Contains id of Event 
> category_id   int(11) No  Contains id of category to which event 
> belongs 
> client_id int(11) No  Contains id of client to which event 
> belongs 
> name  varchar(255)No  Contains name of Event 
> venue varchar(255)No  Contains venue of event 
> description   textNo  Contains description of event 
> image varchar(255)No  no_image.jpgcontains name of image 
> start_datedateNo  Contains start date of event 
> end_date  dateNo  Contains end date of event 
> created   datetimeNo  Contains date when event was 
> added 
> modified  datetimeNo  Contains date when event was 
> last modified 
> ---
> 
> When adding an event, i want to save all fields except 'image',, to do so i 
> am trying to save method with syntax
> 
> $this->Event->save($this->request->data, true, array("Event.name", 
> "Event.venue", "Event.description", "Event.start_date", "Event.end_date", 
> "Event.created", "Event.modified", "Event.category_id", "Event.client_id"))
> 
> But this statement result in
> 
> INSERT INTO `mydb`.`events` (`modified`, `created`) VALUES ('2013-08-07 
> 18:20:39', '2013-08-07 18:20:39')
> 
> instead of 
> 
> INSERT INTO `mydb`.`events` (`category_id`, `client_id`, `name`, `venue`, 
> `description`, `start_date`, `end_date`, `modified`, `created`) VALUES (1, 1, 
> 'My Event', 'Jaipur', 'My Event at Jaipur', '2013-08-07', '2013-08-07', 
> '2013-08-07 18:20:39', '2013-08-07 18:20:39')
> 
> Also when i try to update image field like
> 
> $this->Event->save(array("Event"=>array("id"=>$this->Event->id, 
> "image"=>"myimage.jpg", true)))
> 
> it produces query like
> 
> UPDATE `mydb`.`events` SET `id` = 84  WHERE `mydb`.`events`.`id` = '84'
> 
> 
> i am highly tired, please help me thanks in advanced.
> 
> -- 
> 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/groups/opt_out.
>  
>  

-- 
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/groups/opt_out.




Re: Problem with save method

2013-08-08 Thread Irfan sheikh
do this 
   try like this
 
$this->request->data['Event']['name'] 
= $this->request->data['Event']['name'];
$this->request->data['Event']['venue'] 
= $this->request->data['Event']['venue'];

and then do save all.. 

  $this->Event->save($this->request->data);

 in this way only name and venue will be going into the db ... and the rest 
will be exculded




On Wednesday, 7 August 2013 18:01:05 UTC+5, kapil agrawal wrote:
>
> Hi!
>
> I am a new bee in cakePHP, look at following scenario
>
> I have following tables structure
>
>
> ---
> *Table name: events*
> Field Type Null Default Comments   id int(11) NoContains id of Event  
> category_id 
> int(11) NoContains id of category to which event belongs   client_id 
> int(11) NoContains id of client to which event belongs   name 
> varchar(255) NoContains name of Event   venue varchar(255) NoContains 
> venue of event   description text NoContains description of event   
> *image 
> * *varchar(255)* *No * *no_image.jpg * *contains name of image*  start_date 
> date NoContains start date of event   end_date date NoContains 
> end date of event   created datetime NoContains date when event was 
> added   modified datetime NoContains date when event was last 
> modified 
> ---
>
> When adding an event, i want to save all fields except 'image',, to do so 
> i am trying to save method with syntax
>
> $this->Event->save($this->request->data, true, array("Event.name", 
> "Event.venue", "Event.description", "Event.start_date", "Event.end_date", 
> "Event.created", "Event.modified", "Event.category_id", "Event.client_id"))
>
> But this statement result in
>
> INSERT INTO `mydb`.`events` (`modified`, `created`) VALUES ('2013-08-07 
> 18:20:39', '2013-08-07 18:20:39')
>
> instead of 
>
> INSERT INTO `mydb`.`events` (`category_id`, `client_id`, `name`, `venue`, 
> `description`, `start_date`, `end_date`, `modified`, `created`) VALUES (1, 
> 1, 'My Event', 'Jaipur', 'My Event at Jaipur', '2013-08-07', '2013-08-07', 
> '2013-08-07 18:20:39', '2013-08-07 18:20:39')
>
> Also when i try to update image field like
>
> $this->Event->save(array("Event"=>array("id"=>$this->Event->id, 
> "image"=>"myimage.jpg", true)))
>
> it produces query like
>
> UPDATE `mydb`.`events` SET `id` = 84  WHERE `mydb`.`events`.`id` = '84'
>
>
>
> i am highly tired, please help me thanks in advanced.
>

-- 
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/groups/opt_out.




Re: after div closing tag form ends

2013-08-08 Thread mreza_golestan
echo $this->Form->create('Page');
echo $this->Form->input('slug');
echo $this->Form->input('title');
echo $this->Form->input('content');
؟>


Form->input('view_show');
echo $this->Form->end('Save');
?>


in the above code view_shop field and Submit button is not in the form
because formhelper close the form when see 






--
View this message in context: 
http://cakephp.1045679.n5.nabble.com/after-div-closing-tag-form-ends-tp5715990p5715998.html
Sent from the CakePHP mailing list archive at Nabble.com.

-- 
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/groups/opt_out.


Problem with save method

2013-08-08 Thread kapil agrawal
Hi!

I am a new bee in cakePHP, look at following scenario

I have following tables structure

---
*Table name: events*
Field Type Null Default Comments   id int(11) NoContains id of Event  
category_id 
int(11) NoContains id of category to which event belongs   client_id 
int(11) NoContains id of client to which event belongs   name 
varchar(255) NoContains name of Event   venue varchar(255) NoContains 
venue of event   description text NoContains description of event   *image 
* *varchar(255)* *No * *no_image.jpg * *contains name of image*  start_date 
date NoContains start date of event   end_date date NoContains end 
date of event   created datetime NoContains date when event was added  
modified 
datetime NoContains date when event was last modified 
---

When adding an event, i want to save all fields except 'image',, to do so i 
am trying to save method with syntax

$this->Event->save($this->request->data, true, array("Event.name", 
"Event.venue", "Event.description", "Event.start_date", "Event.end_date", 
"Event.created", "Event.modified", "Event.category_id", "Event.client_id"))

But this statement result in

INSERT INTO `mydb`.`events` (`modified`, `created`) VALUES ('2013-08-07 
18:20:39', '2013-08-07 18:20:39')

instead of 

INSERT INTO `mydb`.`events` (`category_id`, `client_id`, `name`, `venue`, 
`description`, `start_date`, `end_date`, `modified`, `created`) VALUES (1, 
1, 'My Event', 'Jaipur', 'My Event at Jaipur', '2013-08-07', '2013-08-07', 
'2013-08-07 18:20:39', '2013-08-07 18:20:39')

Also when i try to update image field like

$this->Event->save(array("Event"=>array("id"=>$this->Event->id, 
"image"=>"myimage.jpg", true)))

it produces query like

UPDATE `mydb`.`events` SET `id` = 84  WHERE `mydb`.`events`.`id` = '84'



i am highly tired, please help me thanks in advanced.

-- 
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/groups/opt_out.




Re: 3.0: a peek into CakePHP's future

2013-08-08 Thread Muhammad Arslan
It will return both i.e arrays and objects.


On Friday, July 6, 2012 6:17:18 PM UTC+5, Marsson wrote:
>
> Does it mean Cake 3.0´s Model will return objects instead of arrays ?
>
>
>
>
> On Fri, Jul 6, 2012 at 6:33 AM, Kazik >wrote:
>
>>
>> On Friday, July 6, 2012 4:36:03 AM UTC+2, José Lorenzo wrote:
>>
>>>
>>>- Model layer rewrite:
>>>   - Models to return objects from queries
>>>   - Datamapper-like paradigm
>>>   - Richer query API
>>>   - Support for any database type
>>>   - Support for more database drivers both PDO and native
>>>
>>> The new model layer will be an exciting feature. But it also looks like 
>> it is going to be very different from CakePHP 2.
>>
>> Is there going to be an update path for CakePHP 2 apps to CakePHP 3?
>>
>>
>> k 
>>
>> -- 
>> Our newest site for the community: CakePHP Video Tutorials 
>> http://tv.cakephp.org 
>> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
>> others with their CakePHP related questions.
>>  
>>  
>> To unsubscribe from this group, send email to
>> cake-php+u...@googlegroups.com  For more options, visit 
>> this group at http://groups.google.com/group/cake-php
>>
>
>

-- 
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/groups/opt_out.




Re: Convert simple threaded to a tree

2013-08-08 Thread Mohammad Naghavi
Thanks! that saved my life ;)


Java & C# desktop developer
PHP web developer
www.mohamnag.com


On Wed, Aug 7, 2013 at 8:11 PM, euromark  wrote:

> If you already got the parent_id filled out, just use the recover
> functionality of the behavior
> Either from console (CLI) via shell or from your controller action call
> $this->Model->recover()
> This should fix your lft/rght fields based on your parent_id
>
>
> Am Mittwoch, 7. August 2013 19:03:52 UTC+2 schrieb Mohammad Naghavi:
>>
>> I had this model for a long time and my table and model already has
>> parent_id and existing data inside the table has relations. The new fields
>> added are lft and rght which has for now only NULL values inside. I want to
>> fill these in a way that the tree behavior can be used with this existing
>> data and relation.
>>
>> Regards,
>> Mohammad
>> On Aug 7, 2013 6:18 PM, "euromark"  wrote:
>>
>>> Do not forget the parent_id
>>>
>>> Also, what do you mean with existing data?
>>> By default it would all be just a flat list (none of them would have a
>>> parent).
>>> This is also a valid tree
>>>
>>> How would you be able to tell which is the parent of which?
>>> If it can be automated, there is an easy way to do that with Cake.
>>> But first, you need to find out how it can be automated. Otherwise you
>>> need to manually
>>> edit each record.
>>>
>>>
>>> Am Mittwoch, 7. August 2013 17:03:25 UTC+2 schrieb Mohammad Naghavi:

 Hi all,
 this is straight forward, I have a bid table, which used parent_id to
 make a threaded hierarchy. now after a time that the application is used,
 I'm facing problems that can be done perfectly using tree behavior. I have
 added the lft and rght columns but can find an easy way to convert existing
 data into a tree behavior compatible form.

 the last way is to make a temporary table, read from current and write
 into new, and later swap old with new and remove the old, but I have too
 much data in the table that it may not be possible at least at once.

 do you have any idea how to do it easier? It can be done also directly
 in DB (mysql).

 Thanks in advance for any suggestion.
 Mohammad

>>>  --
>>> 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+u...@**googlegroups.com.
>>> To post to this group, send email to cake...@googlegroups.com.
>>>
>>> Visit this group at 
>>> http://groups.google.com/**group/cake-php
>>> .
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out
>>> .
>>>
>>>
>>>
>>  --
> 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/groups/opt_out.
>
>
>

-- 
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/groups/opt_out.