Re: 2 related models in 1 form but validation is working for only 1 model

2011-07-06 Thread varai
Yes, you are right. It is so impt to ensure that all Models are linked
properly. Otherwise nothing will work.

Thanks again

On Jul 7, 9:10 am, "Chaitanya Maili StrApp.net"
 wrote:
> Hi,
>
> So Parent hasMany Child and Child belongsTo Parent
> that is what you need to write in the model relation.
>
> So suppose there is a model called Parent and Child,
> then you should write the following code in the Parent model
> $hasMany = array('Child');
>
> and in the Child model
> $belongsTo = array('Parent');
>
>
>
> On Wed, Jul 6, 2011 at 12:26 PM, varai  wrote:
> > hi,
>
> > What i mean here is one parent can have many children in the same
> > school. One child belongs to one parent.
>
> > So, how can i show that relationship?
>
> > thank you.
>
> > On Jul 6, 8:10 am, "Chaitanya Maili StrApp.net"
> >  wrote:
> > > Hi ,
>
> > > You are providing wrong relations
>
> > > relationships:
> > > Student hasOne MerryParent          (Correct)
> > > MerryParent hasMany Student        (Wrong)
> > > it should be
> > > MerryParent belongsTo Student
>
> > > because In your case Student is the parent table and MerryParent is the
> > > child table.
>
> > > Regards,
> > > Chaitanya.
>
> > > On Tue, Jul 5, 2011 at 10:28 AM, varai  wrote:
> > > > Hi,
>
> > > > I'm having 2 related models in 1 form (add.ctp) but validation is
> > > > working only for 1 model. ie. validation is working fine for Student
> > > > model but not MerryParent model.
>
> > > > Can anyone tell me on what i'm doing wrong? thank you.
>
> > > > relationships:
> > > > Student hasOne MerryParent
> > > > MerryParent hasMany Student
>
> > > > student.php
> > > >  > > > class Student extends AppModel{
> > > >        var $name='Student';
> > > >        var $hasOne=array(
> > > >                        'MerryParent' => array(
> > > >                                'className' => 'MerryParent',
> > > >                                'foreignKey'=>'student_id',
> > > >                                'dependent' => true)
> > > >                                );
> > > >        var $belongsTo='MerryClass';
>
> > > >        var $validate=array(
>
> > > >  'name'=>array('rule'=>array('minLength',1),'message'=>'Name is
> > > > required!'),
> > > >                        'dob'=>array('rule'=>'notEmpty','message'=>'Date
> > of
> > > > Birth is
> > > > required!'),
> > > >                        'class_id'=>array('rule'=>'notEmpty',
> > > > 'message'=>'Which class are
> > > > you enquiring about?')
> > > >                        );
>
> > > > }
> > > > ?>
>
> > > > students_controller.php
> > > >  > > > class StudentsController extends AppController{
>
> > > >        function add(){
> > > >                if (!empty($this->data)){
> > > >                        var_dump($this->data);
> > > >                        die(debug($this->Student->validationErrors));
> > > >                        if ($this->Student->saveAll($this->data))
> > > >                           {
> > > >                                $this->Session->setFlash('Your child\'s
> > > > admission has been
> > > > received. We will send you an email shortly.');
>
> > > >  $this->redirect(array('controller'=>'pages', 'action'=>'home'));
>
> > > >                                }
>
> > > >                   /* else
> > > >                        {
> > > > //die(debug($this->Student->validationErrors));
>
> > > >                        $this->Session->setFlash('Your child\'s
> > admission
> > > > failed to
> > > > save.');
>
> > > >  //$this->redirect(array('controller'=>'pages',
> > > > 'action'=>'home'));
>
> > > >                        }*/
> > > >            } //for if (!empty
> > > >        }//end function
> > > > }
> > > > ?>
>
> > > > merryparent.php
> > > >  > > > class MerryParent extends AppModel{
> > > >         var $name='MerryParent';
> > > >         var $hasMany=array(
> > > >                        'Student'=>array(
> > > >                                'className'=>'Student',
> > > >                                'foreignKey'=>'parent_id'
> > > >                                )
> > > >                        );
> > > >         var $belongsTo='State';
> > > >        var
> > > > $validate=array('initial'=>array('rule'=>'notEmpty','message'=>'Please
> > > > select your initial'),
>
> > > >  'name'=>array('rule'=>array('minLength',1),'message'=>'Name is
> > > > required!'),
>
> > > >  'email'=>array('rule'=>'email','message'=>'Valid email address
> > > > required!','required'=>true, 'allowEmpty'=>false),
>
> > > >  'landline'=>array('rule'=>array('custom','/(0[0-9]{2,4}-[2-9][0-9]
> > > > {5,7})/'), 'required'=>false, 'allowEmpty'=>true, 'message'=>'Invalid
> > > > phone number! phone number format: eg 020-22345678 OR 0544-7573758 OR
> > > > 02345-874567 '),
>
> > > >  'mobile'=>array('rule'=>array('custom','/([89]{1}[0-9]{9})/'),
> > > > 'required'=>true, 'allowEmpty'=>false, 'message'=>'Invalid mobile
> > > > number! mobile number format: eg 9876543211'),
>
> > > >  'address'=>array('rule'=>array('

editing multiple records with beforesave. beforesave working but data not updating

2011-07-06 Thread elogic
Hi All,

I am having some issues with the following: I have 2 tables that I
have saving data to, accounts and users. I need to save the password
field within users as MD5 and so I am using beforesave function in my
model. It seems to be ignoring it though. Any ideas how I can go about
this?

ACCOUNT model

function beforeSave() {
   if ($this->data['User'][0]['password'])
   {
$this->data['User'][0]['password'] = md5($this->data['User'][0]
['password']);
echo $this->data['User'][0]['password'];
   }
   return true;
}
---

NOTE: Above I have echo $this->data['User'][0]['password'], this is
printing out the encrypted password...

ACCOUNT controller
--

function edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid account', true));
$this->redirect(array('action' => 'index'));
}
if (!empty($this->data))
{
if ($this->Account->save($this->data))
{
$this->data['User'][0]['account_id'] = 
$this->Account->id;
$this->Account->User->save($this->data);

$this->Session->setFlash(__('The account has 
been saved', true));
echo "";
print_r($this->data);
echo "";
//$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The account could 
not be saved.
Please, try again.', true));
}
}
if (empty($this->data)) {
$this->data = $this->Account->read(null, $id);
}
//$users = $this->Account->User->find('list');
//$this->set(compact('users'));
}

NOTE: by this stage the password is back to the unencrypted way...
(when I call the print_r($this->data);)


Thanks

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: error when trying to populate state combo box from states table

2011-07-06 Thread varai
I wasn't able to populate the state combo box due to incorrect
relationships between models. Now everything is working fine.
It is so impt to make sure all models are linked to one another
correctly. Otherwise nothing works.


On Jul 6, 12:02 pm, varai  wrote:
> Hi,
>
> I'm trying to populate the state combo box from the states table in db
> and i'm getting the following error:
>
> Notice (8): Undefined property: AppModel::$State [APP\controllers
> \students_controller.php, line 7]Code    }*/
>     function add(){
>         $state=$this->Student->MerryParent->State->find('list',
> array('fields'=>array('State.id','State.name')));
> StudentsController::add() - APP\controllers\students_controller.php,
> line 7
> Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 204
> Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
> [main] - APP\webroot\index.php, line 83
>
> Fatal error: Call to a member function find() on a non-object in C:
> \wamp\www\merry_flowers\controllers\students_controller.php on line 7
>
> The following is my code:
> class StudentsController extends AppController{
>
>         function add(){
>                 $state=$this->Student->MerryParent->State->find('list',
> array('fields'=>array('State.id','State.name')));
>
> I have checked all the model relationships and don't see anything
> wrong. Does anyone know on what I am doing?
> thank you.
>
>

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: relationship between Sate and City

2011-07-06 Thread varai
Thanks a lot Deek. :) I wasn't able to populate the state combo box
due to incorrect relationships between models. Now everything is
working fine.
It is so impt to make sure all models are linked to one another.
Otherwise nothing works.

On Jul 7, 6:24 am, Deek  wrote:
> You don't need to set a foreign key inStateforCity. By adding the
> state_id column in yourcitytable you are establishing the 
> hasMany,StatehasManyCity, and the belongsTo,CitybelongsToState. Just set
> the hasMany and belongsTo properly inStateandCityrespectively and
> the relationship should work.
>
> On Jul 6, 8:49 pm, varai  wrote:
>
>
>
> > Hi,
>
> > I am trying to define relationship betweenstateandcity.
>
> >StatehasManyCity-- foreign key state_id inCity
> >CitybelongsToState
>
> >Statefields: id, state_name
> >Cityfields: id, city_name, state_id
>
> > but forCitybelongsToState, it seems illogically to set a foreign
> > key inStatecoz' thenStaterecords will be repeating.
>
> > What is the best way to go about this?
>
> > thank you.

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: 2 related models in 1 form but validation is working for only 1 model

2011-07-06 Thread Chaitanya Maili StrApp.net
Hi,

So Parent hasMany Child and Child belongsTo Parent
that is what you need to write in the model relation.

So suppose there is a model called Parent and Child,
then you should write the following code in the Parent model
$hasMany = array('Child');

and in the Child model
$belongsTo = array('Parent');

On Wed, Jul 6, 2011 at 12:26 PM, varai  wrote:

> hi,
>
> What i mean here is one parent can have many children in the same
> school. One child belongs to one parent.
>
> So, how can i show that relationship?
>
> thank you.
>
> On Jul 6, 8:10 am, "Chaitanya Maili StrApp.net"
>  wrote:
> > Hi ,
> >
> > You are providing wrong relations
> >
> > relationships:
> > Student hasOne MerryParent  (Correct)
> > MerryParent hasMany Student(Wrong)
> > it should be
> > MerryParent belongsTo Student
> >
> > because In your case Student is the parent table and MerryParent is the
> > child table.
> >
> > Regards,
> > Chaitanya.
> >
> >
> >
> > On Tue, Jul 5, 2011 at 10:28 AM, varai  wrote:
> > > Hi,
> >
> > > I'm having 2 related models in 1 form (add.ctp) but validation is
> > > working only for 1 model. ie. validation is working fine for Student
> > > model but not MerryParent model.
> >
> > > Can anyone tell me on what i'm doing wrong? thank you.
> >
> > > relationships:
> > > Student hasOne MerryParent
> > > MerryParent hasMany Student
> >
> > > student.php
> > >  > > class Student extends AppModel{
> > >var $name='Student';
> > >var $hasOne=array(
> > >'MerryParent' => array(
> > >'className' => 'MerryParent',
> > >'foreignKey'=>'student_id',
> > >'dependent' => true)
> > >);
> > >var $belongsTo='MerryClass';
> >
> > >var $validate=array(
> >
> > >  'name'=>array('rule'=>array('minLength',1),'message'=>'Name is
> > > required!'),
> > >'dob'=>array('rule'=>'notEmpty','message'=>'Date
> of
> > > Birth is
> > > required!'),
> > >'class_id'=>array('rule'=>'notEmpty',
> > > 'message'=>'Which class are
> > > you enquiring about?')
> > >);
> >
> > > }
> > > ?>
> >
> > > students_controller.php
> > >  > > class StudentsController extends AppController{
> >
> > >function add(){
> > >if (!empty($this->data)){
> > >var_dump($this->data);
> > >die(debug($this->Student->validationErrors));
> > >if ($this->Student->saveAll($this->data))
> > >   {
> > >$this->Session->setFlash('Your child\'s
> > > admission has been
> > > received. We will send you an email shortly.');
> >
> > >  $this->redirect(array('controller'=>'pages', 'action'=>'home'));
> >
> > >}
> >
> > >   /* else
> > >{
> > > //die(debug($this->Student->validationErrors));
> >
> > >$this->Session->setFlash('Your child\'s
> admission
> > > failed to
> > > save.');
> >
> > >  //$this->redirect(array('controller'=>'pages',
> > > 'action'=>'home'));
> >
> > >}*/
> > >} //for if (!empty
> > >}//end function
> > > }
> > > ?>
> >
> > > merryparent.php
> > >  > > class MerryParent extends AppModel{
> > > var $name='MerryParent';
> > > var $hasMany=array(
> > >'Student'=>array(
> > >'className'=>'Student',
> > >'foreignKey'=>'parent_id'
> > >)
> > >);
> > > var $belongsTo='State';
> > >var
> > > $validate=array('initial'=>array('rule'=>'notEmpty','message'=>'Please
> > > select your initial'),
> >
> > >  'name'=>array('rule'=>array('minLength',1),'message'=>'Name is
> > > required!'),
> >
> > >  'email'=>array('rule'=>'email','message'=>'Valid email address
> > > required!','required'=>true, 'allowEmpty'=>false),
> >
> > >  'landline'=>array('rule'=>array('custom','/(0[0-9]{2,4}-[2-9][0-9]
> > > {5,7})/'), 'required'=>false, 'allowEmpty'=>true, 'message'=>'Invalid
> > > phone number! phone number format: eg 020-22345678 OR 0544-7573758 OR
> > > 02345-874567 '),
> >
> > >  'mobile'=>array('rule'=>array('custom','/([89]{1}[0-9]{9})/'),
> > > 'required'=>true, 'allowEmpty'=>false, 'message'=>'Invalid mobile
> > > number! mobile number format: eg 9876543211'),
> >
> > >  'address'=>array('rule'=>array('alphaNumeric',array('minLength',
> > > 1),'required'=>true, 'allowEmpty'=>false, 'message'=>'Please enter
> > > your address.'),
> >
> > >  'city'=>array('rule'=>'notEmpty','message'=>'Please select your
> > > city','required'=>true, 'allowEmpty'=>false),
> >
> > >  'state'=>array('rule'=>'notEmpty','message'=>'Please select your
> > > state','required'=

Re: relationship between Sate and City

2011-07-06 Thread Deek
You don't need to set a foreign key in State for City. By adding the
state_id column in your city table you are establishing the hasMany,
State hasMany City, and the belongsTo, City belongsTo State. Just set
the hasMany and belongsTo properly in State and City respectively and
the relationship should work.


On Jul 6, 8:49 pm, varai  wrote:
> Hi,
>
> I am trying to define relationship between state and city.
>
> State hasMany City -- foreign key state_id in City
> City belongsTo State
>
> State fields: id, state_name
> City fields: id, city_name, state_id
>
> but for City belongsTo State, it seems illogically to set a foreign
> key in State coz' then State records will be repeating.
>
> What is the best way to go about this?
>
> thank you.

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


relationship between Sate and City

2011-07-06 Thread varai
Hi,

I am trying to define relationship between state and city.

State hasMany City -- foreign key state_id in City
City belongsTo State

State fields: id, state_name
City fields: id, city_name, state_id

but for City belongsTo State, it seems illogically to set a foreign
key in State coz' then State records will be repeating.

What is the best way to go about this?

thank you.

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Form-Helper (kind of disfunction)

2011-07-06 Thread euromark
i see :L)

where does it post to then?

On 7 Jul., 00:13, func0der  wrote:
> no! it is "admin_home" because i want it to be like that ^^
> It's only the page or better the view i want to open. That has nothing
> to do with the problem itself.
>
> And b): isn't working!
>
> On 4 Jul., 00:15, euromark  wrote:
>
>
>
>
>
>
>
> > a) its not admin_home but home:
> > ('url'=>''/admin/pages/display/home")
> > the admin prefix is already implicitly attached
>
> > b) you are probably looking for
> > ('url' => '/'.$this->params['url']['url'])
> > which always posts exactly to itself (which will be the default in 2.0
> > anyway)
>
> > On 3 Jul., 22:31, func0der  wrote:
>
> > > You mean as a test or as a final solution?
>
> > > Because this is not what i am want. I want the site to reload and make
> > > the needed changes meanwhile in the beforeFilter action.
>
> > > Do you understand?
>
> > > On 28 Jun., 23:19, Francisco ACLima  wrote:
>
> > > > try to go directly to the url  in $this->Form->Create
>
> > > > $this->Form->Create('pages',array('url'=>''/admin/pages/display/
> > > > admin_home));
>
> > > > On 24 jun, 19:10, func0der  wrote:
>
> > > > > Hey guys,
>
> > > > > i'm having a formular present on all sites with the action for this
> > > > > formular located in the beforeFilter function of the AppController.
> > > > > It's kind of a language switcher. This is because i want to have the
> > > > > action of that formular set to the current site url.
>
> > > > > To create this form i use "$this->Form->create('')" in the view. It is
> > > > > working just fine with controller actions like "/companies/index" but
> > > > > with params like in "/admin/pages/display/admin_home" (in this case it
> > > > > is "admin_home") which is routed to "/admin" it is not working.
>
> > > > > This is because the Form-Helper totally ignores the params given to
> > > > > the method.
>
> > > > > I already tried the return value of "$this->Html->url()" as "action"
> > > > > and/or "url" but because of cake giving this to the
> > > > > "HtmlHelper::url()" function so it gets double based if the app is
> > > > > running in a subfolder.
>
> > > > > Even though normal users are not allowed to submit a ticket please
> > > > > submit one for this problem and fix it.
>
> > > > > Or if there is a solution please tell me ;)
>
> > > > > Greetings
> > > > > func0der

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: I got problem in cakedc comment plugin

2011-07-06 Thread taqman filler
public $userModelClass = 'User';

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Form-Helper (kind of disfunction)

2011-07-06 Thread func0der
no! it is "admin_home" because i want it to be like that ^^
It's only the page or better the view i want to open. That has nothing
to do with the problem itself.

And b): isn't working!

On 4 Jul., 00:15, euromark  wrote:
> a) its not admin_home but home:
> ('url'=>''/admin/pages/display/home")
> the admin prefix is already implicitly attached
>
> b) you are probably looking for
> ('url' => '/'.$this->params['url']['url'])
> which always posts exactly to itself (which will be the default in 2.0
> anyway)
>
> On 3 Jul., 22:31, func0der  wrote:
>
>
>
>
>
>
>
> > You mean as a test or as a final solution?
>
> > Because this is not what i am want. I want the site to reload and make
> > the needed changes meanwhile in the beforeFilter action.
>
> > Do you understand?
>
> > On 28 Jun., 23:19, Francisco ACLima  wrote:
>
> > > try to go directly to the url  in $this->Form->Create
>
> > > $this->Form->Create('pages',array('url'=>''/admin/pages/display/
> > > admin_home));
>
> > > On 24 jun, 19:10, func0der  wrote:
>
> > > > Hey guys,
>
> > > > i'm having a formular present on all sites with the action for this
> > > > formular located in the beforeFilter function of the AppController.
> > > > It's kind of a language switcher. This is because i want to have the
> > > > action of that formular set to the current site url.
>
> > > > To create this form i use "$this->Form->create('')" in the view. It is
> > > > working just fine with controller actions like "/companies/index" but
> > > > with params like in "/admin/pages/display/admin_home" (in this case it
> > > > is "admin_home") which is routed to "/admin" it is not working.
>
> > > > This is because the Form-Helper totally ignores the params given to
> > > > the method.
>
> > > > I already tried the return value of "$this->Html->url()" as "action"
> > > > and/or "url" but because of cake giving this to the
> > > > "HtmlHelper::url()" function so it gets double based if the app is
> > > > running in a subfolder.
>
> > > > Even though normal users are not allowed to submit a ticket please
> > > > submit one for this problem and fix it.
>
> > > > Or if there is a solution please tell me ;)
>
> > > > Greetings
> > > > func0der

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Retrograde counterCache

2011-07-06 Thread euromark
and most of the sluggable behaviors I know do provide a similar method
(of course^^ if you change the way the behavior works you need to
trigger the updateAll)
simply copy and paste it

On 6 Jul., 23:26, euromark  wrote:
> well of course you have to trigger it somehow
> but you can simply invoke that for every record (shell, admin action).
>
> some behaviors (i remember this from geocoder et cetera) even have an
> own "updateAll" method
> which does extacly that.
> if not, invent it for yours :)
>
> On 6 Jul., 22:58, Miles J  wrote:
>
>
>
>
>
>
>
> > In that case, just create a shell that loops over everything, runs
> > count queries, and then saves the counter cache value.
>
> > On Jul 6, 1:11 pm, Jeremy Burns | Class Outfit
>
> >  wrote:
> > > I think he's adding it to existing tables, so it won't start from zero. 
> > > He needs to do a find count group by and update the new counterCache 
> > > field.
>
> > > Jeremy Burns
> > > Class Outfit
>
> > >http://www.classoutfit.com
>
> > > On 6 Jul 2011, at 20:21, Miles J wrote:
>
> > > > Well, do you need to populate it right off the bat?
>
> > > > Cake will automatically insert the correct counter value the next time
> > > > a save or delete is made (all it does is a findCount()).
>
> > > > On Jul 6, 10:38 am, Thomas Ploch  wrote:
> > > >> Wouldn't a simple find('all') saveAll() script do the trick?
>
> > > >> Am Mittwoch, den 06.07.2011, 18:29 +0100 schrieb Jeremy Burns | Class
> > > >> Outfit:
>
> > > >>> Doesn't his question relate to populating the counterCache fields with
> > > >>> the right values on creation, rather than maintaining it?
>
> > > >>> Jeremy Burns
> > > >>> Class Outfit
>
> > > >>>http://www.classoutfit.com
>
> > > >>> On 6 Jul 2011, at 17:17, euromark wrote:
>
> > >  there are already several different counterCache solutions available
> > >  one in the core
> > >  see the cookbook or
> > > http://stackoverflow.com/questions/1351823/countercache-in-cake-php
>
> > >  and several als plugins etc
> > >  depends on what exactly you need
>
> > > http://bakery.cakephp.org/articles/danaki/2009/05/29/counter-cache-be...
> > > http://bakery.cakephp.org/articles/dericknwq/2007/05/02/countercache-...
> > > http://www.neilcrookes.com/2010/01/09/cakephp-treecountercachebehavio...
> > >  and probably some more
>
> > >  On 6 Jul., 17:46, Jeremy Burns | Class Outfit
> > >   wrote:
> > > > In my experience you need to do it with a simple SQL query at the
> > > > db level. I am not aware of any Cake magic. If it's a continuous
> > > > problem worthy of some dev time you could write a simple behaviour
> > > > to do it.
>
> > > > Jeremy Burns
> > > > Class Outfit
>
> > > >http://www.classoutfit.com
>
> > > > On 6 Jul 2011, at 16:43, wiseguysonly wrote:
>
> > > >> One of my early CakePHP sites has come back to haunt me. I need
> > > >> to add
> > > >> a counterCache to a pre-existing hasMany relationship.
>
> > > >> Does there exist a method to set up the counterCache with
> > > >> current
> > > >> counts field once I have have created it?
>
> > > >> Thanks in advance,
>
> > > >> Tim
>
> > > >> --
> > > >> Our newest site for the community: CakePHP Video
> > > >> Tutorialshttp://tv.cakephp.org
> > > >> Check out the new CakePHP Questions
> > > >> sitehttp://ask.cakephp.organdhelpotherswiththeir CakePHP
> > > >> related questions.
>
> > > >> To unsubscribe from this group, send email to
> > > >> cake-php+unsubscr...@googlegroups.com For more options, visit
> > > >> this group athttp://groups.google.com/group/cake-php
>
> > >  --
> > >  Our newest site for the community: CakePHP Video Tutorials
> > > http://tv.cakephp.org
> > >  Check out the new CakePHP Questions sitehttp://ask.cakephp.organd
> > >  help others with their CakePHP related questions.
>
> > >  To unsubscribe from this group, send email to
> > >  cake-php+unsubscr...@googlegroups.com For more options, visit this
> > >  group athttp://groups.google.com/group/cake-php
>
> > > >>> --
> > > >>> Our newest site for the community: CakePHP Video Tutorials
> > > >>>http://tv.cakephp.org
> > > >>> Check out the new CakePHP Questions sitehttp://ask.cakephp.organd
> > > >>> help others with their CakePHP related questions.
>
> > > >>> To unsubscribe from this group, send email to
> > > >>> cake-php+unsubscr...@googlegroups.com For more options, visit this
> > > >>> group athttp://groups.google.com/group/cake-php
>
> > > > --
> > > > Our newest site for the community: CakePHP Video 
> > > > Tutorialshttp://tv.cakephp.org
> > > > Check out the new CakePHP Questions 
> > > > sitehttp://ask.cakephp.organdhelpothers with their CakePHP related 
> > > > questions.
>
> > > > To unsubscribe from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.com For more options, visit this 
> > > > group athttp://groups.google.com/grou

Re: find data in index view foreach loop

2011-07-06 Thread elogic
Thankyou, how would I go about calling it within the properties view
foreach loop?

I tried this:
 $estate_name = $this->getEstateName($property['Property']
['estate_id']);

and then I tried:
echo getEstateName($property['Property']['estate_id']);


but both times I got errors like this:
Call to undefined method View::getEstateName()

My properties controller file has this now:
public function getEstateName($accountId)
{
return $this->Property->User->find('first', array('conditions' 
=>
array('Account.id' => $accountId), 'fields' =>
array('Account.first_name', 'Account.last_name')));
}


Thanks


On Jul 6, 5:06 pm, Vulinux  wrote:
> Hi elogic,
>
> since your methods for getting estate- and staff names are supposed to
> be called more than once, I would recommend to outsource your code
> into model methods, so you can easily call them from your controller
> and don't have any code repitition.
>
> /*
>  * @param int $accountId: The Account Id to be looked for
>  */
>
> public function getEstateName ($accountId)
> {
>   return $this->Property->User->find('first', array('conditions'
>      => array('Account.id' => $accountId),
> 'fields' => array('Account.first_name', 'Account.last_name')));
>
> }
>
> Same with the staff names. You can then call it in all of your
> controller functions and use the data for ... stuff.
>
> Kind regards,
> Vulinux
>
> On 6 Jul., 06:13, elogic  wrote:
>
>
>
>
>
>
>
> > Hi All,
>
> > I have on my view page of properties in the controller which is
> > working as I want it to.
>
> > // GET THE ESTATE AND STAFF NAMES
> > $estate_name = $this->Property->User->find('first', array('conditions'
> > => array('Account.id' => $this->Property->field('estate_id')),
> > 'fields' => array('Account.first_name', 'Account.last_name')));
> > $staff_name = $this->Property->User->find('first', array('conditions'
> > => array('Account.id' => $this->Property->field('staff_id')), 'fields'
> > => array('Account.first_name', 'Account.last_name')));
> > $this->set(compact('estate_name','staff_name'));
>
> > (Call them like:  > ' . $estate_name['Account']['last_name']; ?>)
>
> > I somehow need to get this same data on the index view within a for
> > loop for each row, how would I go about this? The estate_name and
> > staff_name need to be found for each record down the page.
>
> > Thankyou

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Retrograde counterCache

2011-07-06 Thread euromark
well of course you have to trigger it somehow
but you can simply invoke that for every record (shell, admin action).

some behaviors (i remember this from geocoder et cetera) even have an
own "updateAll" method
which does extacly that.
if not, invent it for yours :)


On 6 Jul., 22:58, Miles J  wrote:
> In that case, just create a shell that loops over everything, runs
> count queries, and then saves the counter cache value.
>
> On Jul 6, 1:11 pm, Jeremy Burns | Class Outfit
>
>
>
>
>
>
>
>  wrote:
> > I think he's adding it to existing tables, so it won't start from zero. He 
> > needs to do a find count group by and update the new counterCache field.
>
> > Jeremy Burns
> > Class Outfit
>
> >http://www.classoutfit.com
>
> > On 6 Jul 2011, at 20:21, Miles J wrote:
>
> > > Well, do you need to populate it right off the bat?
>
> > > Cake will automatically insert the correct counter value the next time
> > > a save or delete is made (all it does is a findCount()).
>
> > > On Jul 6, 10:38 am, Thomas Ploch  wrote:
> > >> Wouldn't a simple find('all') saveAll() script do the trick?
>
> > >> Am Mittwoch, den 06.07.2011, 18:29 +0100 schrieb Jeremy Burns | Class
> > >> Outfit:
>
> > >>> Doesn't his question relate to populating the counterCache fields with
> > >>> the right values on creation, rather than maintaining it?
>
> > >>> Jeremy Burns
> > >>> Class Outfit
>
> > >>>http://www.classoutfit.com
>
> > >>> On 6 Jul 2011, at 17:17, euromark wrote:
>
> >  there are already several different counterCache solutions available
> >  one in the core
> >  see the cookbook or
> > http://stackoverflow.com/questions/1351823/countercache-in-cake-php
>
> >  and several als plugins etc
> >  depends on what exactly you need
>
> > http://bakery.cakephp.org/articles/danaki/2009/05/29/counter-cache-be...
> > http://bakery.cakephp.org/articles/dericknwq/2007/05/02/countercache-...
> > http://www.neilcrookes.com/2010/01/09/cakephp-treecountercachebehavio...
> >  and probably some more
>
> >  On 6 Jul., 17:46, Jeremy Burns | Class Outfit
> >   wrote:
> > > In my experience you need to do it with a simple SQL query at the
> > > db level. I am not aware of any Cake magic. If it's a continuous
> > > problem worthy of some dev time you could write a simple behaviour
> > > to do it.
>
> > > Jeremy Burns
> > > Class Outfit
>
> > >http://www.classoutfit.com
>
> > > On 6 Jul 2011, at 16:43, wiseguysonly wrote:
>
> > >> One of my early CakePHP sites has come back to haunt me. I need
> > >> to add
> > >> a counterCache to a pre-existing hasMany relationship.
>
> > >> Does there exist a method to set up the counterCache with
> > >> current
> > >> counts field once I have have created it?
>
> > >> Thanks in advance,
>
> > >> Tim
>
> > >> --
> > >> Our newest site for the community: CakePHP Video
> > >> Tutorialshttp://tv.cakephp.org
> > >> Check out the new CakePHP Questions
> > >> sitehttp://ask.cakephp.organdhelpotherswith their CakePHP
> > >> related questions.
>
> > >> To unsubscribe from this group, send email to
> > >> cake-php+unsubscr...@googlegroups.com For more options, visit
> > >> this group athttp://groups.google.com/group/cake-php
>
> >  --
> >  Our newest site for the community: CakePHP Video Tutorials
> > http://tv.cakephp.org
> >  Check out the new CakePHP Questions sitehttp://ask.cakephp.organd
> >  help others with their CakePHP related questions.
>
> >  To unsubscribe from this group, send email to
> >  cake-php+unsubscr...@googlegroups.com For more options, visit this
> >  group athttp://groups.google.com/group/cake-php
>
> > >>> --
> > >>> Our newest site for the community: CakePHP Video Tutorials
> > >>>http://tv.cakephp.org
> > >>> Check out the new CakePHP Questions sitehttp://ask.cakephp.organd
> > >>> help others with their CakePHP related questions.
>
> > >>> To unsubscribe from this group, send email to
> > >>> cake-php+unsubscr...@googlegroups.com For more options, visit this
> > >>> group athttp://groups.google.com/group/cake-php
>
> > > --
> > > Our newest site for the community: CakePHP Video 
> > > Tutorialshttp://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp 
> > > others with their CakePHP related questions.
>
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > > athttp://groups.google.com/group/cake-php

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Retrograde counterCache

2011-07-06 Thread Miles J
In that case, just create a shell that loops over everything, runs
count queries, and then saves the counter cache value.

On Jul 6, 1:11 pm, Jeremy Burns | Class Outfit
 wrote:
> I think he's adding it to existing tables, so it won't start from zero. He 
> needs to do a find count group by and update the new counterCache field.
>
> Jeremy Burns
> Class Outfit
>
> http://www.classoutfit.com
>
> On 6 Jul 2011, at 20:21, Miles J wrote:
>
>
>
>
>
>
>
> > Well, do you need to populate it right off the bat?
>
> > Cake will automatically insert the correct counter value the next time
> > a save or delete is made (all it does is a findCount()).
>
> > On Jul 6, 10:38 am, Thomas Ploch  wrote:
> >> Wouldn't a simple find('all') saveAll() script do the trick?
>
> >> Am Mittwoch, den 06.07.2011, 18:29 +0100 schrieb Jeremy Burns | Class
> >> Outfit:
>
> >>> Doesn't his question relate to populating the counterCache fields with
> >>> the right values on creation, rather than maintaining it?
>
> >>> Jeremy Burns
> >>> Class Outfit
>
> >>>http://www.classoutfit.com
>
> >>> On 6 Jul 2011, at 17:17, euromark wrote:
>
>  there are already several different counterCache solutions available
>  one in the core
>  see the cookbook or
> http://stackoverflow.com/questions/1351823/countercache-in-cake-php
>
>  and several als plugins etc
>  depends on what exactly you need
>
> http://bakery.cakephp.org/articles/danaki/2009/05/29/counter-cache-be...
> http://bakery.cakephp.org/articles/dericknwq/2007/05/02/countercache-...
> http://www.neilcrookes.com/2010/01/09/cakephp-treecountercachebehavio...
>  and probably some more
>
>  On 6 Jul., 17:46, Jeremy Burns | Class Outfit
>   wrote:
> > In my experience you need to do it with a simple SQL query at the
> > db level. I am not aware of any Cake magic. If it's a continuous
> > problem worthy of some dev time you could write a simple behaviour
> > to do it.
>
> > Jeremy Burns
> > Class Outfit
>
> >http://www.classoutfit.com
>
> > On 6 Jul 2011, at 16:43, wiseguysonly wrote:
>
> >> One of my early CakePHP sites has come back to haunt me. I need
> >> to add
> >> a counterCache to a pre-existing hasMany relationship.
>
> >> Does there exist a method to set up the counterCache with
> >> current
> >> counts field once I have have created it?
>
> >> Thanks in advance,
>
> >> Tim
>
> >> --
> >> Our newest site for the community: CakePHP Video
> >> Tutorialshttp://tv.cakephp.org
> >> Check out the new CakePHP Questions
> >> sitehttp://ask.cakephp.organdhelpothers with their CakePHP
> >> related questions.
>
> >> To unsubscribe from this group, send email to
> >> cake-php+unsubscr...@googlegroups.com For more options, visit
> >> this group athttp://groups.google.com/group/cake-php
>
>  --
>  Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
>  Check out the new CakePHP Questions sitehttp://ask.cakephp.organd
>  help others with their CakePHP related questions.
>
>  To unsubscribe from this group, send email to
>  cake-php+unsubscr...@googlegroups.com For more options, visit this
>  group athttp://groups.google.com/group/cake-php
>
> >>> --
> >>> Our newest site for the community: CakePHP Video Tutorials
> >>>http://tv.cakephp.org
> >>> Check out the new CakePHP Questions sitehttp://ask.cakephp.organd
> >>> help others with their CakePHP related questions.
>
> >>> To unsubscribe from this group, send email to
> >>> cake-php+unsubscr...@googlegroups.com For more options, visit this
> >>> group athttp://groups.google.com/group/cake-php
>
> > --
> > Our newest site for the community: CakePHP Video 
> > Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Single query at bootstrap: how to

2011-07-06 Thread ark0n3
After some tests it seems like the connection is reset after this
first query (I had to use $this->query in place of $this->execute), so
all the dates are visualized as in the old timezone. I already tried
with a simple "set timezone etc; SELECT date;" from console/phpmyadmin
and it works so it surely is a problem with cakephp that "reset" the
connection, thus resetting the new timezone setting too.. Any advice??

thanks

On Jul 4, 6:00 pm, majna  wrote:
> Using AppModel constructor works for me:
>
> function __construct($id = null, $table = null, $ds = null)
>     {
>         parent::__construct($id, $table, $ds);
>         if (!defined('GLOBAL_ZONE_SET') && $this->useTable !== false)
>         {
>             $this->execute("SET GLOBAL time_zone = ‘+2:00′'");
>             define('GLOBAL_ZONE_SET', true);
>         }
>     }
>
> On Jul 4, 4:31 pm, ark0n3  wrote:
>
>
>
>
>
>
>
> > Hi everyone
> > I'm going crazy for such a trivial matter. I need to run a one-time
> >queryat the beginning of the connection to the mysql server (SET
> > GLOBAL time_zone = ‘+2:00′) but can't figure out where I need to put
> > the code in the cake codebase.
>
> > Many thanks in advance to whoever will help me fix this.
>
> > ps i already tried in the contructor of app_model.php but got not luck
> > with cake 1.2.10

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: What is best way to do this?

2011-07-06 Thread Tilen Majerle
make a your custom Lib, put class file into app/libs and import it to
AppController :)
--
Lep pozdrav, Tilen Majerle
http://majerle.eu



2011/7/6 Matheus Oliveira" 

> I have a function in my AppController called "sendEmail", and when I
> need send a email in any part of my app I call $this-
> >sendEmail($param1, $param2, ...).
>
> Now i need send email by Shell, how i can do this without duplicate
> the code?
>
> Import the AppController in the Shell or move the function code to a
> Task and import it in the AppController?
>
> What best way? If possible show a exemple. :-)
>
> --
> 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+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


What is best way to do this?

2011-07-06 Thread Matheus Oliveira"
I have a function in my AppController called "sendEmail", and when I
need send a email in any part of my app I call $this-
>sendEmail($param1, $param2, ...).

Now i need send email by Shell, how i can do this without duplicate
the code?

Import the AppController in the Shell or move the function code to a
Task and import it in the AppController?

What best way? If possible show a exemple. :-)

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Retrograde counterCache

2011-07-06 Thread Jeremy Burns | Class Outfit
I think he's adding it to existing tables, so it won't start from zero. He 
needs to do a find count group by and update the new counterCache field.

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 6 Jul 2011, at 20:21, Miles J wrote:

> Well, do you need to populate it right off the bat?
> 
> Cake will automatically insert the correct counter value the next time
> a save or delete is made (all it does is a findCount()).
> 
> On Jul 6, 10:38 am, Thomas Ploch  wrote:
>> Wouldn't a simple find('all') saveAll() script do the trick?
>> 
>> Am Mittwoch, den 06.07.2011, 18:29 +0100 schrieb Jeremy Burns | Class
>> Outfit:
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> Doesn't his question relate to populating the counterCache fields with
>>> the right values on creation, rather than maintaining it?
>> 
>>> Jeremy Burns
>>> Class Outfit
>> 
>>> http://www.classoutfit.com
>> 
>>> On 6 Jul 2011, at 17:17, euromark wrote:
>> 
 there are already several different counterCache solutions available
 one in the core
 see the cookbook or
 http://stackoverflow.com/questions/1351823/countercache-in-cake-php
>> 
 and several als plugins etc
 depends on what exactly you need
>> 
 http://bakery.cakephp.org/articles/danaki/2009/05/29/counter-cache-be...
 http://bakery.cakephp.org/articles/dericknwq/2007/05/02/countercache-...
 http://www.neilcrookes.com/2010/01/09/cakephp-treecountercachebehavio...
 and probably some more
>> 
 On 6 Jul., 17:46, Jeremy Burns | Class Outfit
  wrote:
> In my experience you need to do it with a simple SQL query at the
> db level. I am not aware of any Cake magic. If it's a continuous
> problem worthy of some dev time you could write a simple behaviour
> to do it.
>> 
> Jeremy Burns
> Class Outfit
>> 
> http://www.classoutfit.com
>> 
> On 6 Jul 2011, at 16:43, wiseguysonly wrote:
>> 
>> One of my early CakePHP sites has come back to haunt me. I need
>> to add
>> a counterCache to a pre-existing hasMany relationship.
>> 
>> Does there exist a method to set up the counterCache with
>> current
>> counts field once I have have created it?
>> 
>> Thanks in advance,
>> 
>> Tim
>> 
>> --
>> Our newest site for the community: CakePHP Video
>> Tutorialshttp://tv.cakephp.org
>> Check out the new CakePHP Questions
>> sitehttp://ask.cakephp.organdhelp others with their CakePHP
>> related questions.
>> 
>> To unsubscribe from this group, send email to
>> cake-php+unsubscr...@googlegroups.com For more options, visit
>> this group athttp://groups.google.com/group/cake-php
>> 
 --
 Our newest site for the community: CakePHP Video Tutorials
 http://tv.cakephp.org
 Check out the new CakePHP Questions sitehttp://ask.cakephp.organd
 help others with their CakePHP related questions.
>> 
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this
 group athttp://groups.google.com/group/cake-php
>> 
>>> --
>>> Our newest site for the community: CakePHP Video Tutorials
>>> http://tv.cakephp.org
>>> Check out the new CakePHP Questions sitehttp://ask.cakephp.organd
>>> help others with their CakePHP related questions.
>> 
>>> To unsubscribe from this group, send email to
>>> cake-php+unsubscr...@googlegroups.com For more options, visit this
>>> group athttp://groups.google.com/group/cake-php
> 
> -- 
> 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+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: I got problem in cakedc comment plugin

2011-07-06 Thread Jens Dittrich
to me it looks like you should the userModelClass when using the Comments 
plugin. Tried that?

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Retrograde counterCache

2011-07-06 Thread Miles J
Well, do you need to populate it right off the bat?

Cake will automatically insert the correct counter value the next time
a save or delete is made (all it does is a findCount()).

On Jul 6, 10:38 am, Thomas Ploch  wrote:
> Wouldn't a simple find('all') saveAll() script do the trick?
>
> Am Mittwoch, den 06.07.2011, 18:29 +0100 schrieb Jeremy Burns | Class
> Outfit:
>
>
>
>
>
>
>
> > Doesn't his question relate to populating the counterCache fields with
> > the right values on creation, rather than maintaining it?
>
> > Jeremy Burns
> > Class Outfit
>
> >http://www.classoutfit.com
>
> > On 6 Jul 2011, at 17:17, euromark wrote:
>
> > > there are already several different counterCache solutions available
> > > one in the core
> > > see the cookbook or
> > >http://stackoverflow.com/questions/1351823/countercache-in-cake-php
>
> > > and several als plugins etc
> > > depends on what exactly you need
>
> > >http://bakery.cakephp.org/articles/danaki/2009/05/29/counter-cache-be...
> > >http://bakery.cakephp.org/articles/dericknwq/2007/05/02/countercache-...
> > >http://www.neilcrookes.com/2010/01/09/cakephp-treecountercachebehavio...
> > > and probably some more
>
> > > On 6 Jul., 17:46, Jeremy Burns | Class Outfit
> > >  wrote:
> > > > In my experience you need to do it with a simple SQL query at the
> > > > db level. I am not aware of any Cake magic. If it's a continuous
> > > > problem worthy of some dev time you could write a simple behaviour
> > > > to do it.
>
> > > > Jeremy Burns
> > > > Class Outfit
>
> > > >http://www.classoutfit.com
>
> > > > On 6 Jul 2011, at 16:43, wiseguysonly wrote:
>
> > > > > One of my early CakePHP sites has come back to haunt me. I need
> > > > > to add
> > > > > a counterCache to a pre-existing hasMany relationship.
>
> > > > > Does there exist a method to set up the counterCache with
> > > > > current
> > > > > counts field once I have have created it?
>
> > > > > Thanks in advance,
>
> > > > > Tim
>
> > > > > --
> > > > > Our newest site for the community: CakePHP Video
> > > > > Tutorialshttp://tv.cakephp.org
> > > > > Check out the new CakePHP Questions
> > > > > sitehttp://ask.cakephp.organdhelp others with their CakePHP
> > > > > related questions.
>
> > > > > To unsubscribe from this group, send email to
> > > > > cake-php+unsubscr...@googlegroups.com For more options, visit
> > > > > this group athttp://groups.google.com/group/cake-php
>
> > > --
> > > Our newest site for the community: CakePHP Video Tutorials
> > >http://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd
> > > help others with their CakePHP related questions.
>
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this
> > > group athttp://groups.google.com/group/cake-php
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd
> > help others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this
> > group athttp://groups.google.com/group/cake-php

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Retrieving objects from the DB instead of arrays

2011-07-06 Thread Miles J
True, forgot that Cake uses Set a lot.

On Jul 6, 10:06 am, mark_story  wrote:
> ArrayAccess and real arrays are very different things, so this won't
> work.  Try using Set on an object graph that implements ArrayAccess.
> It will go pretty poorly.  If it were that simple it would have been
> done by now.
>
> -Mark
>
> On Jul 5, 4:24 pm, Miles J  wrote:
>
>
>
>
>
>
>
> > Couldn't we just have the DB call return a "QueryResponse" object that
> > maps all the values together and associated models (also as
> > QueryResponse objects). Then give it ArrayAccess functionality for
> > backwards compatibility?
>
> > (I haven't thought much into it, just throwing it out there.)
>
> > On Jul 5, 11:06 am, stephenrs  wrote:
>
> > > Thanks for your reply, Mark. I'd just chime in by agreeing that it is hard
> > > to build an ORM...but since this wheel has already been invented..and
> > > reinvented, it's hard to justify why a new ORM would need to be built for
> > > Cake. There are already several mature PHP-based ORM systems (Doctrine and
> > > Propel leading the pack) that are ripe for straightforward integration 
> > > into
> > > larger systems.
>
> > > So, rather than a backwards-compatibility-killing overhaul of Cake's model
> > > system, perhaps a better approach would be to start by offering Cake
> > > developers a choice by allowing the data access layer to be toggled 
> > > between
> > > returning the traditional arrays and returning objects via an existing ORM
> > > that has been plugged in. Maybe this toggle could even be set application-
> > > or controller-wide via the configuration system, or at run time for more
> > > granular control. Doctrine offers this toggle out of the box, for example.
>
> > > This way, developers have a choice to migrate all, some, or none of an
> > > existing application to an object oriented model system. Maybe there's
> > > something about Cake's design that would make even this kind of 
> > > architecture
> > > unfeasibly difficult, but based on my (admittedly rusty) understanding of
> > > Cake's internals, it shouldn't be too bad. Core system components could
> > > transparently continue to use the array access method as long as they 
> > > needed
> > > to, and userland code could break free of arrays if it wanted to.
>
> > > Having been away for a few years, I'm actually a bit amazed (and
> > > disappointed) that the 2.0 release isn't being used as an opportunity to
> > > bring Cake more fully into the world of OOP. I'm not one to complain about
> > > open source software though...I have much to be thankful for.
>
> > > -SS

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Retrograde counterCache

2011-07-06 Thread Thomas Ploch
Wouldn't a simple find('all') saveAll() script do the trick?

Am Mittwoch, den 06.07.2011, 18:29 +0100 schrieb Jeremy Burns | Class
Outfit:
> Doesn't his question relate to populating the counterCache fields with
> the right values on creation, rather than maintaining it?
> 
> Jeremy Burns
> Class Outfit
> 
> http://www.classoutfit.com
> 
> On 6 Jul 2011, at 17:17, euromark wrote:
> 
> > there are already several different counterCache solutions available
> > one in the core
> > see the cookbook or
> > http://stackoverflow.com/questions/1351823/countercache-in-cake-php
> > 
> > and several als plugins etc
> > depends on what exactly you need
> > 
> > http://bakery.cakephp.org/articles/danaki/2009/05/29/counter-cache-behavior-for-habtm-relations
> > http://bakery.cakephp.org/articles/dericknwq/2007/05/02/countercache-or-counter_cache-behavior
> > http://www.neilcrookes.com/2010/01/09/cakephp-treecountercachebehavior-plugin/
> > and probably some more
> > 
> > 
> > On 6 Jul., 17:46, Jeremy Burns | Class Outfit
> >  wrote:
> > > In my experience you need to do it with a simple SQL query at the
> > > db level. I am not aware of any Cake magic. If it's a continuous
> > > problem worthy of some dev time you could write a simple behaviour
> > > to do it.
> > > 
> > > Jeremy Burns
> > > Class Outfit
> > > 
> > > http://www.classoutfit.com
> > > 
> > > On 6 Jul 2011, at 16:43, wiseguysonly wrote:
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > > One of my early CakePHP sites has come back to haunt me. I need
> > > > to add
> > > > a counterCache to a pre-existing hasMany relationship.
> > > 
> > > > Does there exist a method to set up the counterCache with
> > > > current
> > > > counts field once I have have created it?
> > > 
> > > > Thanks in advance,
> > > 
> > > > Tim
> > > 
> > > > --
> > > > Our newest site for the community: CakePHP Video
> > > > Tutorialshttp://tv.cakephp.org
> > > > Check out the new CakePHP Questions
> > > > sitehttp://ask.cakephp.organd help others with their CakePHP
> > > > related questions.
> > > 
> > > > To unsubscribe from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.com For more options, visit
> > > > this group athttp://groups.google.com/group/cake-php
> > 
> > -- 
> > 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+unsubscr...@googlegroups.com For more options, visit this
> > group at http://groups.google.com/group/cake-php
> > 
> 
> 
> 
> -- 
> 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+unsubscr...@googlegroups.com For more options, visit this
> group at http://groups.google.com/group/cake-php


-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Retrograde counterCache

2011-07-06 Thread Jeremy Burns | Class Outfit
Doesn't his question relate to populating the counterCache fields with the 
right values on creation, rather than maintaining it?

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 6 Jul 2011, at 17:17, euromark wrote:

> there are already several different counterCache solutions available
> one in the core
> see the cookbook or
> http://stackoverflow.com/questions/1351823/countercache-in-cake-php
> 
> and several als plugins etc
> depends on what exactly you need
> 
> http://bakery.cakephp.org/articles/danaki/2009/05/29/counter-cache-behavior-for-habtm-relations
> http://bakery.cakephp.org/articles/dericknwq/2007/05/02/countercache-or-counter_cache-behavior
> http://www.neilcrookes.com/2010/01/09/cakephp-treecountercachebehavior-plugin/
> and probably some more
> 
> 
> On 6 Jul., 17:46, Jeremy Burns | Class Outfit
>  wrote:
>> In my experience you need to do it with a simple SQL query at the db level. 
>> I am not aware of any Cake magic. If it's a continuous problem worthy of 
>> some dev time you could write a simple behaviour to do it.
>> 
>> Jeremy Burns
>> Class Outfit
>> 
>> http://www.classoutfit.com
>> 
>> On 6 Jul 2011, at 16:43, wiseguysonly wrote:
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> One of my early CakePHP sites has come back to haunt me. I need to add
>>> a counterCache to a pre-existing hasMany relationship.
>> 
>>> Does there exist a method to set up the counterCache with current
>>> counts field once I have have created it?
>> 
>>> Thanks in advance,
>> 
>>> Tim
>> 
>>> --
>>> Our newest site for the community: CakePHP Video 
>>> Tutorialshttp://tv.cakephp.org
>>> Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
>>> others with their CakePHP related questions.
>> 
>>> To unsubscribe from this group, send email to
>>> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
>>> athttp://groups.google.com/group/cake-php
> 
> -- 
> 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+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Retrieving objects from the DB instead of arrays

2011-07-06 Thread mark_story
ArrayAccess and real arrays are very different things, so this won't
work.  Try using Set on an object graph that implements ArrayAccess.
It will go pretty poorly.  If it were that simple it would have been
done by now.

-Mark

On Jul 5, 4:24 pm, Miles J  wrote:
> Couldn't we just have the DB call return a "QueryResponse" object that
> maps all the values together and associated models (also as
> QueryResponse objects). Then give it ArrayAccess functionality for
> backwards compatibility?
>
> (I haven't thought much into it, just throwing it out there.)
>
> On Jul 5, 11:06 am, stephenrs  wrote:
>
>
>
>
>
>
>
> > Thanks for your reply, Mark. I'd just chime in by agreeing that it is hard
> > to build an ORM...but since this wheel has already been invented..and
> > reinvented, it's hard to justify why a new ORM would need to be built for
> > Cake. There are already several mature PHP-based ORM systems (Doctrine and
> > Propel leading the pack) that are ripe for straightforward integration into
> > larger systems.
>
> > So, rather than a backwards-compatibility-killing overhaul of Cake's model
> > system, perhaps a better approach would be to start by offering Cake
> > developers a choice by allowing the data access layer to be toggled between
> > returning the traditional arrays and returning objects via an existing ORM
> > that has been plugged in. Maybe this toggle could even be set application-
> > or controller-wide via the configuration system, or at run time for more
> > granular control. Doctrine offers this toggle out of the box, for example.
>
> > This way, developers have a choice to migrate all, some, or none of an
> > existing application to an object oriented model system. Maybe there's
> > something about Cake's design that would make even this kind of architecture
> > unfeasibly difficult, but based on my (admittedly rusty) understanding of
> > Cake's internals, it shouldn't be too bad. Core system components could
> > transparently continue to use the array access method as long as they needed
> > to, and userland code could break free of arrays if it wanted to.
>
> > Having been away for a few years, I'm actually a bit amazed (and
> > disappointed) that the 2.0 release isn't being used as an opportunity to
> > bring Cake more fully into the world of OOP. I'm not one to complain about
> > open source software though...I have much to be thankful for.
>
> > -SS

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Retrieving objects from the DB instead of arrays

2011-07-06 Thread mark_story
There isn't anything stopping you from using Doctrine or Propel now if
you feel not having them is a huge loss.  Other parts of cake loose
some of the integrated features, but it can be made to work.  The loss
of integration is another reason that we haven't moved to another ORM,
we'd either have to couple with that ORM which is simliar to where we
are now. Or loose many of the features in cake that people like.
Things like var $uses = array(...); don't work without layers of
adapters and configuration when the models could come from a variety
of providers.  Perhaps integrating with Doctrine, PHPActiveRecord or
Propel would be the best option in the future.  I'm not sure, I
haven't done the research and haven't evaluated the options versus
rolling an update to cake's models.

As for things not changing in 2.0, we decided that revamping parts of
the framework that needed php4 support removed, and switching the
models all at once would probably create a huge time gap between
releases and was something we want to avoid.

Sorry that we couldn't better live up to your expectations.

-Mark

On Jul 5, 2:06 pm, stephenrs  wrote:
> Thanks for your reply, Mark. I'd just chime in by agreeing that it is hard
> to build an ORM...but since this wheel has already been invented..and
> reinvented, it's hard to justify why a new ORM would need to be built for
> Cake. There are already several mature PHP-based ORM systems (Doctrine and
> Propel leading the pack) that are ripe for straightforward integration into
> larger systems.
>
> So, rather than a backwards-compatibility-killing overhaul of Cake's model
> system, perhaps a better approach would be to start by offering Cake
> developers a choice by allowing the data access layer to be toggled between
> returning the traditional arrays and returning objects via an existing ORM
> that has been plugged in. Maybe this toggle could even be set application-
> or controller-wide via the configuration system, or at run time for more
> granular control. Doctrine offers this toggle out of the box, for example.
>
> This way, developers have a choice to migrate all, some, or none of an
> existing application to an object oriented model system. Maybe there's
> something about Cake's design that would make even this kind of architecture
> unfeasibly difficult, but based on my (admittedly rusty) understanding of
> Cake's internals, it shouldn't be too bad. Core system components could
> transparently continue to use the array access method as long as they needed
> to, and userland code could break free of arrays if it wanted to.
>
> Having been away for a few years, I'm actually a bit amazed (and
> disappointed) that the 2.0 release isn't being used as an opportunity to
> bring Cake more fully into the world of OOP. I'm not one to complain about
> open source software though...I have much to be thankful for.
>
> -SS

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Retrograde counterCache

2011-07-06 Thread euromark
there are already several different counterCache solutions available
one in the core
see the cookbook or
http://stackoverflow.com/questions/1351823/countercache-in-cake-php

and several als plugins etc
depends on what exactly you need

http://bakery.cakephp.org/articles/danaki/2009/05/29/counter-cache-behavior-for-habtm-relations
http://bakery.cakephp.org/articles/dericknwq/2007/05/02/countercache-or-counter_cache-behavior
http://www.neilcrookes.com/2010/01/09/cakephp-treecountercachebehavior-plugin/
and probably some more


On 6 Jul., 17:46, Jeremy Burns | Class Outfit
 wrote:
> In my experience you need to do it with a simple SQL query at the db level. I 
> am not aware of any Cake magic. If it's a continuous problem worthy of some 
> dev time you could write a simple behaviour to do it.
>
> Jeremy Burns
> Class Outfit
>
> http://www.classoutfit.com
>
> On 6 Jul 2011, at 16:43, wiseguysonly wrote:
>
>
>
>
>
>
>
> > One of my early CakePHP sites has come back to haunt me. I need to add
> > a counterCache to a pre-existing hasMany relationship.
>
> > Does there exist a method to set up the counterCache with current
> > counts field once I have have created it?
>
> > Thanks in advance,
>
> > Tim
>
> > --
> > Our newest site for the community: CakePHP Video 
> > Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Retrograde counterCache

2011-07-06 Thread Jeremy Burns | Class Outfit
In my experience you need to do it with a simple SQL query at the db level. I 
am not aware of any Cake magic. If it's a continuous problem worthy of some dev 
time you could write a simple behaviour to do it.

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 6 Jul 2011, at 16:43, wiseguysonly wrote:

> One of my early CakePHP sites has come back to haunt me. I need to add
> a counterCache to a pre-existing hasMany relationship.
> 
> Does there exist a method to set up the counterCache with current
> counts field once I have have created it?
> 
> Thanks in advance,
> 
> Tim
> 
> -- 
> 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+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Retrograde counterCache

2011-07-06 Thread wiseguysonly
One of my early CakePHP sites has come back to haunt me. I need to add
a counterCache to a pre-existing hasMany relationship.

Does there exist a method to set up the counterCache with current
counts field once I have have created it?

Thanks in advance,

Tim

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


CakePHP core tests are failing tests from clean install

2011-07-06 Thread Josh


I've just downloaded Cake PHP 1.3, and installed SimpleTest 1.0.1 into the 
vendors directory. When I run cake testsuite core all I get the following 
error:

Running core all PHP Fatal error: Cannot redeclare class Article in 
/Users/../cake/tests/cases/libs/model/models.php on line 283

If I run test groups or test cases individually, many of them fail.

This is a clean install, I've done no development other than the basic 
configuration setup (security salt, cipherSeed and database config).

Has anyone else had problem, and what did you do to solve it?

I found this 
thread with the 
exact same question, but it was not resolved or at least the 
resolution was not posted in that thread.

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: i18n

2011-07-06 Thread Johan
You can use a third-party tool such as POEdit to scan your sources for i18n
strings. You can define which files to scan and what functions to search.

Cheers,
- Johan

On Tue, Jul 5, 2011 at 5:57 PM, Carlos Eduardo Sotelo Pinto <
carlos.sotelo.pi...@gmail.com> wrote:

> Hi people
>
> When I use cakephp i18n, I must wite the sentences as
>
> 
> Form->input('name', array(__('Un nombre', true))); ?>
>
> Then, I must do the next lines for extract the tranlate words
>
> $ cake i18n
> e
>
> Now, I am working with a template engine, dwoo, the main idea is avoid
> using "" on views. For get this functionality on my views, I
> have create a helper
>
> class I18nHelper extends AppHelper {
>
>function get_text($string, $flag = FALSE) {
>return $string;
>}
>
> }
>
> And the sentences will be on this way, using teh helper
>
> {$i18n->get_text('Una Cadena')}
> {$form->input('name', array($i18n->get_text('Un Nombre')))}
>
> Also I have edit the file
>
> /cake/libs/tasks/extract.php
>
> fo adding the line
>
> $this->__parse('get_text', array('singular'));
>
> on the method
>
> function _extractTokens() // línea 220
>
> and then, after do
>
> $ cake i18n
> e
>
> I couldnt get anythingf of my tranlated lines. I have notiec that the
> extract.php file use the php funciotn "tokens_get_all", then I can
> supouse that my dwoo tags "{}" are not readed by this funcions and my
> i18n wont work.
>
> My question is find a solution to this issue and get the best way for
> work with i18n using "{}" instead of ""
>
> Thanks
>
> Carlos
>
> --
> 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+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


blog question

2011-07-06 Thread Magician
Hi.  I am trying to create a blog with cakephp and on the screen where
the user enters their post, selects their user name, etc., I would
like there to be a list down add the bottom of the screen that lists
the tag(s) a user can stick to their blog post.  How would I
accomplish this?

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Newbie Question - Controller Model Binding

2011-07-06 Thread euromark
where did you find that?
sounds totally wrong to be. but i would need to see the source in
order to tell you if its worthy to read.

you usually create
- model
- controller
- views
in this order (using the baking tools this is quite comfortable)


it is as alive as is gets :)
of course you turn up old results as the framework is already in
existance for quite some time
and some issues from the past are cake1 oder cake1.2 related

nowadays with cake1.3 there might be other new issues - or the same
ones in a slightly different way


On 5 Jul., 20:37, gavrielh  wrote:
> Just jumping into CakePHP and while I've gotten quite deep in the code
> already, awesome by the way, I found one article that threw me for a
> loop.  Basically it suggested that one should only create controllers
> for database tables and for nothing else.  This seems a bit strange,
> why would I not be able to create a controller for a backend class or
> something not directly tied to the model?
>
> Also, on a side note - I notice that a lot of my searches on Google
> for CakePHP related topics return very old posts - is CakePHP still
> alive and well?

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Where can i save custom images?

2011-07-06 Thread Santiago Basulto
Good,

thanks man. I'll try that.

On Jul 6, 10:26 am, mi...@brightstorm.co.uk wrote:
> > Hello People.
>
> > I've a website where users can save their own profile picture. I'm
> > storing those pics in /app/webroot/img/uploads (chown to that
> > uploads).
>
> > The problem is that every time i want to update the site to a newer
> > version, i've to move the entire uploads folder.
>
> you should store your app folder outside of your cake directory.
>
> mine sits something like this
>
> /project/cake/
> /project/app/
> /project/webroot/
>
> you just need to point your host file to serve from /project/webroot/ and
> then define paths for ROOT, APP_DIR and CAKE_CORE_INCLUDE_PATH inside
> webroot/index.php
>
>
>
>
>
>
>
>
>
> > Where can i store them to avoid this situation?
>
> > Thanks.
>
> > --
> >Santiago Basulto.-
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group
> > athttp://groups.google.com/group/cake-php

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: upload and import csv to mysql

2011-07-06 Thread Gopinath Manimayan
Yes i too need solution for this issue
On 6 Jul 2011 07:39, "elogic"  wrote:
>
> Hi All,
>
> I have setup a file upload feature for my application using the below
> plugin. Now that I have the csv uploading using an upload controller
> and model I now need to insert the csv into a mysql table. I haven't
> had much luck with the samples I have found online. Does anyone know
> how I can do this? I can get my client to name the fields however it
> needs to be done so that isn't an issue.
>
>
> MY UPLOADS_CONTROLLER
> -
> class UploadsController extends AppController
> {
>
>var $name = 'Uploads';
>
>// CSV UPLOAD
>//
--
> >
>function upload() {
>
>if (!empty($this->data))
>{
>$this->Upload->create();
>if($this->Upload->save($this->data))
>{
>$this->Session->setFlash(__('The
file has been saved', true));
>//print_r($this->data);
>$thefilename =
 $this->data['Upload']['file']['name'];
>echo $thefilename; // the uploaded
CSV FILE NAME!
>
>
>// TO DO PROCESS UPLOADED FILE INTO
PROPERTIES DATABSE
>}
>else
>{
>$this->Session->setFlash(__('The
file could not be saved. Please,
> try again.', true));
>}
>
>}
>}
>
> }
> 
>
> MY UPLOADS MODEL
> -
>  class Upload extends AppModel {
> var $name = 'Upload';
> var $actsAs = array(
>  'FileUpload.FileUpload' => array(
>'uploadDir' => 'files',
>'forceWebroot' => true, //if false, uploads will be saved
to
>
  //the uploadDir as a direct path.
>
  //default: true
>/*
>'fields' => array(
>  'name' => 'file_name',
>  'type' => 'file_type',
>  'size' => 'file_size'
>),
>*/
>'allowedTypes' => array(
>  'csv' => array('text/csv', 'application/csv')
>),
>'maxFileSize' => '100', //in bytes
>'unique' => false, //uploaded files will overwrite existing
files
>'fileNameFunction' => false, //execute sha1 on fileName if
required,
> not though
>  )
>);
> }
> --
>
>
> Thanks
>
>
>
>
> FILE UPLOAD PLUGIN:
http://www.webtechnick.com/blogs/view/221/CakePHP_File_Upload_Plugin
>
> --
> 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+unsubscr...@googlegroups.com For more options, visit this group
at http://groups.google.com/group/cake-php

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Newbie Question - Controller Model Binding

2011-07-06 Thread gavrielh
Just jumping into CakePHP and while I've gotten quite deep in the code
already, awesome by the way, I found one article that threw me for a
loop.  Basically it suggested that one should only create controllers
for database tables and for nothing else.  This seems a bit strange,
why would I not be able to create a controller for a backend class or
something not directly tied to the model?

Also, on a side note - I notice that a lot of my searches on Google
for CakePHP related topics return very old posts - is CakePHP still
alive and well?

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Help with populating SELECT drop down

2011-07-06 Thread spottmedia
@grigri, thanks that was exactly what I needed, never remember the SET::
function, it's brilliant.

-
HonkBlog |Tech notes. Notes, fixes, tips and suggestions from across my 
technical world 
--
View this message in context: 
http://cakephp.19694.n2.nabble.com/Help-with-populating-SELECT-drop-down-tp1518635p6549639.html
Sent from the CakePHP mailing list archive at Nabble.com.

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


How to save associated objects at one shot.

2011-07-06 Thread vini
I have five models and their relationship at the database level is
> Member
> Trainee(member_id references Member id,order_id references Order id)
>ContctPerson(person_id reference Member id)
>Address
>Order(contactperson_id references ContactPerson id ,address_id references 
>Address id )

and i have set associations in models also .and i am writting many
trainees objects ,one contact person and address object in to session
and when i call $this->Order->saveAll($this->session->read()).it is
not saving all the objects .

so what  are the steps to save the objects.is this possible to save
these objects at one shot by calling saveAll in orders controller.

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: wizard component multiple

2011-07-06 Thread Thomas Ploch
Yes, a very easy way would be how it is supposed to be:

1 Controller for 1 Wizard.
2 Controllers for 2 Wizards.

End of story :)

I think making the Wizard Component work for this case is more hassle
then just use seperate Controllers.

Regards
Thomas

Am Mittwoch, den 06.07.2011, 10:50 -0300 schrieb Renato de Freitas
Freire:
> Hello.
> I think it will give you many troubles.
> First, you will need a newinstance of the component, otherwise it will
> conflict with the first instance you are already using.
> Then you will be able to use like $this->Wizard1->steps and
> $this->Wizard2->steps, got it?
> But even that way it may not work, since the session variables will be
> the same, and will conflict.
> 
> Why do you need to use this component two diferent times in the same 
> controller?
> May be there is an easier way to do what you want.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> On Wednesday, July 6, 2011, Dominik Gajewski  
> wrote:
> > Put all methods which do you want to reuse to AppController, this is
> > my suggestion.
> >
> > 2011/7/4 olga :
> >> hi,
> >> i use the wizard component https://github.com/jaredhoyt/cakephp-wizard
> >> and it works fine.
> >> now i want to use it a second time on the website, in the same
> >> controller.
> >> is this possible an what i have to do?
> >> if i define $steps a second time, ist doesn'work.
> >> thanks and best regards
> >> olga
> >>
> >> --
> >> 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+unsubscr...@googlegroups.com For more options, visit this group 
> >> at http://groups.google.com/group/cake-php
> >>
> >
> >
> >
> > --
> > Pozdrawiam
> > Dominik Gajewski
> >
> > --
> > 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+unsubscr...@googlegroups.com For more options, visit this group at 
> > http://groups.google.com/group/cake-php
> >
> 
> -- 
> 
> --
> Renato Freire
> (31) 2514-3806 / 9968-1366
> ren...@gsp.net.br
> 


-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: wizard component multiple

2011-07-06 Thread Renato de Freitas Freire
Hello.
I think it will give you many troubles.
First, you will need a newinstance of the component, otherwise it will
conflict with the first instance you are already using.
Then you will be able to use like $this->Wizard1->steps and
$this->Wizard2->steps, got it?
But even that way it may not work, since the session variables will be
the same, and will conflict.

Why do you need to use this component two diferent times in the same controller?
May be there is an easier way to do what you want.









On Wednesday, July 6, 2011, Dominik Gajewski  wrote:
> Put all methods which do you want to reuse to AppController, this is
> my suggestion.
>
> 2011/7/4 olga :
>> hi,
>> i use the wizard component https://github.com/jaredhoyt/cakephp-wizard
>> and it works fine.
>> now i want to use it a second time on the website, in the same
>> controller.
>> is this possible an what i have to do?
>> if i define $steps a second time, ist doesn'work.
>> thanks and best regards
>> olga
>>
>> --
>> 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+unsubscr...@googlegroups.com For more options, visit this group at 
>> http://groups.google.com/group/cake-php
>>
>
>
>
> --
> Pozdrawiam
> Dominik Gajewski
>
> --
> 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+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php
>

-- 

--
Renato Freire
(31) 2514-3806 / 9968-1366
ren...@gsp.net.br

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


I got problem in cakedc comment plugin

2011-07-06 Thread taqman filler
*this is noob question*
*i got **Notice (8) :
Undefined index: $userModel
[APP\plugins\comments\views\elements\comments\flat\item.ctp, line 28] I
remember declare public $components = array('Comments.Comments' =>
array('userModelClass' => 'Users.User'));* I should check where?

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Where can i save custom images?

2011-07-06 Thread mikek
> Hello People.
>
> I've a website where users can save their own profile picture. I'm
> storing those pics in /app/webroot/img/uploads (chown to that
> uploads).
>
> The problem is that every time i want to update the site to a newer
> version, i've to move the entire uploads folder.

you should store your app folder outside of your cake directory.

mine sits something like this

/project/cake/
/project/app/
/project/webroot/

you just need to point your host file to serve from /project/webroot/ and
then define paths for ROOT, APP_DIR and CAKE_CORE_INCLUDE_PATH inside
webroot/index.php





>
> Where can i store them to avoid this situation?
>
> Thanks.
>
> --
> Santiago Basulto.-
>
> --
> 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+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>
>


-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Where can i save custom images?

2011-07-06 Thread Santiago Basulto
Hello People.

I've a website where users can save their own profile picture. I'm
storing those pics in /app/webroot/img/uploads (chown to that
uploads).

The problem is that every time i want to update the site to a newer
version, i've to move the entire uploads folder.

Where can i store them to avoid this situation?

Thanks.

-- 
Santiago Basulto.-

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


How do you work when using jquery on a multilingual project?

2011-07-06 Thread heohni
Hi,

I have a multilingual project and I am using the P28n and  methods.
But I am also doing a lot of Ajax stuff and from time to time I have
the need to output text via my javascript files.

Is there anyhow a way / a trick ( how to use the cakephp translation
() in my js files?

Thanks! I look forward to your appreciated answers!

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Mssql query problem

2011-07-06 Thread Earnest
I solved...

I added this line on php.ini (MSSQL section):

mssql.datetimeconvert = Off


On 3 Lug, 02:32, Earnest  wrote:
> Thank you Tilen,
>
> but I'm using query() function so $useTable is not a problem. Anyway I
> tried but no way.
>
> If I use
>
> $this->set('time', $this->Tparkevent->query('SELECT [field_name]
> FROM
> [table_name] WHERE Id = 1'));
>
> it works ok except for the datetime PCTimeStamp field. It seems to me
> that the problem is the datetime mssql (eg. 01/01/98 23:59:59.999)
>
> thank you for helping me!
>
> On 3 Lug, 00:52, Tilen Majerle  wrote:
>
>
>
>
>
>
>
> > define your table name in your model class
>
> > var $useTable = 'tableName';
>
> > --
> > Lep pozdrav, Tilen Majerlehttp://majerle.eu
>
> > 2011/7/2 Earnest 
>
> > > I'm using a different table, no Tparkevent...
>
> > > On 2 Lug, 20:58, Tilen Majerle  wrote:
> > > > why not you do like this
>
> > > > $this->set('time', $this->Tparkevent->read(null, '1'));
>
> > > > --
> > > > Lep pozdrav, Tilen Majerlehttp://majerle.eu
>
> > > > 2011/7/2 Earnest 
>
> > > > > Hi,
>
> > > > > I'm running cake on a standard lamp installation. I've a controller to
> > > > > make queries to a mssql db. All goes well but a particular query
> > > > > involving a standard datatime (in mssql).
>
> > > > > The query:
>
> > > > > $this->set('time', $this->Tparkevent->query('SELECT PCTimeStamp  FROM
> > > > > [table_name] WERE Id = 1'));
>
> > > > > Well...on browser I get a blank page :(
>
> > > > > Trying a similar query but not on datetime typos, well all goes ok.
>
> > > > > Please help me...
>
> > > > > --
> > > > > Our newest site for the community: CakePHP Video Tutorials
> > > > >http://tv.cakephp.org
> > > > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> > > > > others with their CakePHP related questions.
>
> > > > > To unsubscribe from this group, send email to
> > > > > cake-php+unsubscr...@googlegroups.com For more options, visit this
> > > group
> > > > > athttp://groups.google.com/group/cake-php
>
> > > --
> > > Our newest site for the community: CakePHP Video Tutorials
> > >http://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> > > others with their CakePHP related questions.
>
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this group
> > > athttp://groups.google.com/group/cake-php

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: separate class that prepares an IteratorAggregate object for View layer - where to place this?

2011-07-06 Thread Zeu5
Thank you.

It worked.

I have made a note to myself about not ever using numbers in class
names for vendor and lib files.

On Jul 6, 3:19 pm, Thomas Ploch  wrote:
> Hi,
>
> What is the filename in the 'lib' directory? Try
> 'app/lib/array_to_iterator_aggregate.php' as filename and use
> 'App::import("Lib", "ArrayToIteratorAggregate")'
>
> Am Dienstag, den 05.07.2011, 14:56 -0700 schrieb Zeu5:
>
>
>
>
>
>
>
> > Hi Thomas,
>
> > this is my code for the beforeRender. I got a Class not found error.
>
> > Fatal error: Class 'Array2IteratorAggregate' not found.
>
> >  > function beforeRender() {
> >            App::import('Lib', 'Array2IteratorAggregate');
>
> >            $iterators = empty($this->viewVars['TwigObjects']
> > ['IteratorAggregate']) ?
> >                                    array() : 
> > $this->viewVars['TwigObjects']['IteratorAggregate'];
>
> >            foreach($iterators as $alias) {
> >                    $array = empty($this->viewVars[$alias]) ?
> >                            array() : $this->viewVars[$alias];
> >                    if (is_array($array) AND !empty($array)) {
> >                            $this->viewVars[$alias] = 
> > Array2IteratorAggregate::a2ia($array);
>
> >                            $items = $this->viewVars[$alias];
>
> >                            if( !is_array( $items ) && !$items instanceof 
> > Traversable ) {
> >                                    $this->log('not working');
> >                            } else {
> >                                    $this->log(' working');
> >                            }
> >                            $this->log($array);
> >                    }
> >            }
> >    }
> > ?>
>
> >http://bin.cakephp.org/view/1692840979in case you prefer paste.
>
> > my file in app/libs is array_2_iterator_aggregate.php
> > the code inside that file is found 
> > here.http://bin.cakephp.org/view/1592385093
>
> > On Jul 5, 8:18 pm, Thomas Ploch  wrote:
> > > Hello,
>
> > > well, I would set the Arrays that should be converted to the Itearator
> > > objects to a special viewVar, i.e.:
>
> > > In your Controller action
> > >  > >         $iterators = array();
> > >         $cars = $this->Car->find('all');
> > >         $trucks = $this->Truck->find('all');
>
> > >         $iterators = Set::merge($iterators, $cars, $trucks);
> > >         $this->set(compact('iterators'));
> > > ?>
>
> > > In AppController::beforeRender(), this way you can use this everywhere
> > > if you add to the iterators viewVar
> > >  > >         $iterators = empty($this->viewVars['iterators']) ? array() :
> > > $this->viewVars['iterators'];
> > >         foreach($iterators as $alias => $data) {
> > >                 $iterators[$alias] = 
> > > ArrayConverter::createAggregator($data);
> > >         }
> > >         $this->viewVars['iterators'] = $iterators;
> > > ?>
>
> > > ArrayConverter is a library class in 'app/lib/array_converter.php' that
> > > you can load with App::import().
>
> > > Regards,
> > > Thomas
>
> > > Am Dienstag, den 05.07.2011, 04:20 -0700 schrieb Zeu5:
>
> > > > Hi Thomas,
>
> > > > let me state my concerns here. Perhaps you can tell me if your
> > > > suggested answer is still good for the scenario.
>
> > > > I have various models and controllers.
>
> > > > Cars, Trucks, Tables, Chairs, Users, Passengers, etc.
>
> > > > I have admin actions: Admin_view, admin_edit, admin_add,
> > > > Actions for public are view, edit, add, etc.
>
> > > > I will use Twig for Themes  on views that are for public consumption.
>
> > > > And i will not expose all the data models for designers to manipulate.
> > > > Just to be clear, i will expose only cars, trucks and passengers in
> > > > their respective index page.
>
> > > > 1) Having said this, the IteratorAggregate class should still be in
> > > > app lib?
>
> > > > 2) the Controller::beforeRender you would mean in cars, trucks and
> > > > passengers controllers only right?
>
> > > > 3) so far your idea sounds good as i typed this response. I am liking
> > > > it.
>
> > > > On Jul 5, 6:53 pm, Thomas Ploch  wrote:
> > > > > Well, you would not do it on the Behavior itself, since you want to 
> > > > > pass
> > > > > the object to the view.
>
> > > > > Probably a static method as in your example that converts the find 
> > > > > array
> > > > > into an object that implements IteratorAggregate (probably 'app/lib' 
> > > > > is
> > > > > the best place for this).
>
> > > > > Then in Controller::beforeRender you could iterate over the viewVars 
> > > > > and
> > > > > convert the arrays accordingly.
>
> > > > > Regards,
> > > > > Thomas
>
> > > > > Am Dienstag, den 05.07.2011, 02:41 -0700 schrieb Zeu5:
>
> > > > > > Hi there,
>
> > > > > > i think you mean a Model Behavior?
>
> > > > > > If so, do i still need to create a separate class which implements 
> > > > > > the
> > > > > > IteratorAggregate?
>
> > > > > > If so, is it done in the same file as the Behavior?
>
> > > > > > Thank you.
>
> > > > > > On Jul 5, 5:28 pm, e

Re: wizard component multiple

2011-07-06 Thread Dominik Gajewski
Put all methods which do you want to reuse to AppController, this is
my suggestion.

2011/7/4 olga :
> hi,
> i use the wizard component https://github.com/jaredhoyt/cakephp-wizard
> and it works fine.
> now i want to use it a second time on the website, in the same
> controller.
> is this possible an what i have to do?
> if i define $steps a second time, ist doesn'work.
> thanks and best regards
> olga
>
> --
> 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+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php
>



-- 
Pozdrawiam
Dominik Gajewski

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Retrieving objects from the DB instead of arrays

2011-07-06 Thread Jens Dittrich
Hi, I have just read your article and it is an interesting option to use 
propel in Cake. But what part of cake are you still using with the objects 
you get from propel? Like Mark said, the behaviors and components and so on 
are expecting arrays not objects... Where is the benefit that Cake usually 
provides when using real ORM?
Besides that I have to say that the first part of your "justification" seems 
strange to me. Cake follows convention over configuration but that does not 
mean you can't configure. If your table and field names do not fit the 
convention, then configure the mapping in cake. Table and field names are no 
problems. How can this be an argument then?
The second part with the composite primary keys sticks. That is something I 
would really like to use myself with cake. 

regards,
jens

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: How compare fields in one query from different tables

2011-07-06 Thread Quarck
I solve my problem!. It necessary to create file of model temp_detail.php 
with this content:
class TempDetail extends AppModel {
var $name = 'TempDetail';
var $useTable = *false*;
}

After that everything is works. Here code in the controller: 
$tmpModel = 'TempDetail';
$tmpTable = 'temp_details';
$this->Incident->query('CREATE TEMPORARY TABLE temp_details  ...');
$this->Incident->query('INSERT INTO temp_details ...');
App::import('Model', 'TempDetail');
$this->loadModel('TempDetail');

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Aw: Re: application not Caching , why ?

2011-07-06 Thread Vulinux
As dtemes already mentioned: Change the owner of your tmp directory and all 
directories lying below to your apache user e.g. (chown -R 
apacheuser:youruser). Then change the mode to 755 and everything should work 
fine.

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: application not Caching , why ?

2011-07-06 Thread dtemes
Try changing the group of your files to the apache or www-data group
and set permissions based on the group, so that you don't have to
grant universal access to the files.

On 6 jul, 02:22, Matt Murphy  wrote:
> Threat:  So long as you don't have anything that uploads, you'll be OK.
> It's only a problem if someone can place a file.  If they can't, you can't
> be hurt.  Review what you have installed...  Good luck!
>
> MM
>
> On Tue, Jul 5, 2011 at 12:43 PM, Ritesh R Aryal 
> wrote:
>
>
>
>
>
>
>
> > Thank you for your suggestion.
> > Yes, u r right, it is shared hosting.
> > But it may cause the security risk. IF I assign the folder permission
> > as 0777 the any one hack.
> > So, worrying about it.
>
> > On Jul 4, 1:34 pm, Matt Murphy  wrote:
> > > Your're probably on shared hosting.  You log in as X, Apache runs as Y.
> >  It
> > > needs the "others" "write" bit set if it is to write to the filesystem.
>
> > > Or that's my best guess...
>
> > > MM
> > > On Mon, Jul 4, 2011 at 7:12 AM, Ritesh R Aryal  > >wrote:
>
> > > > Hi everyone,
>
> > > > My application is not caching why ?
>
> > > > What could be the reason. If the permission of the tmp folder set to
> > > > 0777 then it does caching and if it is set to 0755 it stop caching.
>
> > > > Furthermore, my application is creating a text file into server and it
> > > > has stop working dont know why. If i set the permission to 0777 then
> > > > it works straight away otherwise not.
>
> > > > WHAT COULD BE THE BEST SOLUTION ON CAKE ??
>
> > > > --
> > > > Our newest site for the community: CakePHP Video Tutorials
> > > >http://tv.cakephp.org
> > > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> > > > others with their CakePHP related questions.
>
> > > > To unsubscribe from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.com For more options, visit this
> > group
> > > > athttp://groups.google.com/group/cake-php
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group
> > athttp://groups.google.com/group/cake-php

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: separate class that prepares an IteratorAggregate object for View layer - where to place this?

2011-07-06 Thread Thomas Ploch
Hi,

What is the filename in the 'lib' directory? Try
'app/lib/array_to_iterator_aggregate.php' as filename and use
'App::import("Lib", "ArrayToIteratorAggregate")'

Am Dienstag, den 05.07.2011, 14:56 -0700 schrieb Zeu5:
> Hi Thomas,
> 
> this is my code for the beforeRender. I got a Class not found error.
> 
> Fatal error: Class 'Array2IteratorAggregate' not found.
> 
>  function beforeRender() {
>   App::import('Lib', 'Array2IteratorAggregate');
> 
>   $iterators = empty($this->viewVars['TwigObjects']
> ['IteratorAggregate']) ?
>   array() : 
> $this->viewVars['TwigObjects']['IteratorAggregate'];
> 
>   foreach($iterators as $alias) {
>   $array = empty($this->viewVars[$alias]) ?
>   array() : $this->viewVars[$alias];
>   if (is_array($array) AND !empty($array)) {
>   $this->viewVars[$alias] = 
> Array2IteratorAggregate::a2ia($array);
> 
>   $items = $this->viewVars[$alias];
> 
>   if( !is_array( $items ) && !$items instanceof 
> Traversable ) {
>   $this->log('not working');
>   } else {
>   $this->log(' working');
>   }
>   $this->log($array);
>   }
>   }
>   }
> ?>
> 
> http://bin.cakephp.org/view/1692840979 in case you prefer paste.
> 
> my file in app/libs is array_2_iterator_aggregate.php
> the code inside that file is found here. 
> http://bin.cakephp.org/view/1592385093
> 
> 
> On Jul 5, 8:18 pm, Thomas Ploch  wrote:
> > Hello,
> >
> > well, I would set the Arrays that should be converted to the Itearator
> > objects to a special viewVar, i.e.:
> >
> > In your Controller action
> >  > $iterators = array();
> > $cars = $this->Car->find('all');
> > $trucks = $this->Truck->find('all');
> >
> > $iterators = Set::merge($iterators, $cars, $trucks);
> > $this->set(compact('iterators'));
> > ?>
> >
> > In AppController::beforeRender(), this way you can use this everywhere
> > if you add to the iterators viewVar
> >  > $iterators = empty($this->viewVars['iterators']) ? array() :
> > $this->viewVars['iterators'];
> > foreach($iterators as $alias => $data) {
> > $iterators[$alias] = 
> > ArrayConverter::createAggregator($data);
> > }
> > $this->viewVars['iterators'] = $iterators;
> > ?>
> >
> > ArrayConverter is a library class in 'app/lib/array_converter.php' that
> > you can load with App::import().
> >
> > Regards,
> > Thomas
> >
> > Am Dienstag, den 05.07.2011, 04:20 -0700 schrieb Zeu5:
> >
> >
> >
> >
> >
> >
> >
> > > Hi Thomas,
> >
> > > let me state my concerns here. Perhaps you can tell me if your
> > > suggested answer is still good for the scenario.
> >
> > > I have various models and controllers.
> >
> > > Cars, Trucks, Tables, Chairs, Users, Passengers, etc.
> >
> > > I have admin actions: Admin_view, admin_edit, admin_add,
> > > Actions for public are view, edit, add, etc.
> >
> > > I will use Twig for Themes  on views that are for public consumption.
> >
> > > And i will not expose all the data models for designers to manipulate.
> > > Just to be clear, i will expose only cars, trucks and passengers in
> > > their respective index page.
> >
> > > 1) Having said this, the IteratorAggregate class should still be in
> > > app lib?
> >
> > > 2) the Controller::beforeRender you would mean in cars, trucks and
> > > passengers controllers only right?
> >
> > > 3) so far your idea sounds good as i typed this response. I am liking
> > > it.
> >
> > > On Jul 5, 6:53 pm, Thomas Ploch  wrote:
> > > > Well, you would not do it on the Behavior itself, since you want to pass
> > > > the object to the view.
> >
> > > > Probably a static method as in your example that converts the find array
> > > > into an object that implements IteratorAggregate (probably 'app/lib' is
> > > > the best place for this).
> >
> > > > Then in Controller::beforeRender you could iterate over the viewVars and
> > > > convert the arrays accordingly.
> >
> > > > Regards,
> > > > Thomas
> >
> > > > Am Dienstag, den 05.07.2011, 02:41 -0700 schrieb Zeu5:
> >
> > > > > Hi there,
> >
> > > > > i think you mean a Model Behavior?
> >
> > > > > If so, do i still need to create a separate class which implements the
> > > > > IteratorAggregate?
> >
> > > > > If so, is it done in the same file as the Behavior?
> >
> > > > > Thank you.
> >
> > > > > On Jul 5, 5:28 pm, euromark  wrote:
> > > > > > i see
> > > > > > you would probably need a global app controller behavior which
> > > > > > translates everything right away
> >
> > > > > > php doesnt have the attributes itself
> > > > > > but you can acomplish that by using:
> > > > > > $size = count($car

Re: find data in index view foreach loop

2011-07-06 Thread Vulinux
Hi elogic,

since your methods for getting estate- and staff names are supposed to
be called more than once, I would recommend to outsource your code
into model methods, so you can easily call them from your controller
and don't have any code repitition.

/*
 * @param int $accountId: The Account Id to be looked for
 */

public function getEstateName ($accountId)
{
  return $this->Property->User->find('first', array('conditions'
 => array('Account.id' => $accountId),
'fields' => array('Account.first_name', 'Account.last_name')));
}

Same with the staff names. You can then call it in all of your
controller functions and use the data for ... stuff.

Kind regards,
Vulinux

On 6 Jul., 06:13, elogic  wrote:
> Hi All,
>
> I have on my view page of properties in the controller which is
> working as I want it to.
>
> // GET THE ESTATE AND STAFF NAMES
> $estate_name = $this->Property->User->find('first', array('conditions'
> => array('Account.id' => $this->Property->field('estate_id')),
> 'fields' => array('Account.first_name', 'Account.last_name')));
> $staff_name = $this->Property->User->find('first', array('conditions'
> => array('Account.id' => $this->Property->field('staff_id')), 'fields'
> => array('Account.first_name', 'Account.last_name')));
> $this->set(compact('estate_name','staff_name'));
>
> (Call them like:  ' . $estate_name['Account']['last_name']; ?>)
>
> I somehow need to get this same data on the index view within a for
> loop for each row, how would I go about this? The estate_name and
> staff_name need to be found for each record down the page.
>
> Thankyou

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


error when trying to populate state combo box from states table

2011-07-06 Thread varai
Hi,

I'm trying to populate the state combo box from the states table in db
and i'm getting the following error:

Notice (8): Undefined property: AppModel::$State [APP\controllers
\students_controller.php, line 7]Code}*/
function add(){
$state=$this->Student->MerryParent->State->find('list',
array('fields'=>array('State.id','State.name')));
StudentsController::add() - APP\controllers\students_controller.php,
line 7
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 204
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
[main] - APP\webroot\index.php, line 83

Fatal error: Call to a member function find() on a non-object in C:
\wamp\www\merry_flowers\controllers\students_controller.php on line 7

The following is my code:
class StudentsController extends AppController{

function add(){
$state=$this->Student->MerryParent->State->find('list',
array('fields'=>array('State.id','State.name')));

I have checked all the model relationships and don't see anything
wrong. Does anyone know on what I am doing?
thank you.

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php