Wednesday, November 30, 2011

Re: Spaces in Filenames (Theme / Themed / Upgrade Cake 1.3 to Cake 2.0)

The alternative is moving your assets to the web root, instead of symlinking them, I guess.

Cheers,
Graham Weldon
http://grahamweldon.com
e. graham@grahamweldon.com
p. (+61) 0407 017 293
Skype: grahamweldon

On Thursday, 1 December 2011 at 5:03 PM, zuha wrote:

I don't believe symlink will be possible (or at a minimum would be a big annoyance) because I run an unlimited number of apps from custom directories and each one contains its own theme directory.   I would much rather just figure out where to do something like... 

$fileName = str_replace('%20', ' ', $fileName); 

...to get it to show, but can't find where to do that in the core.  I tried ThemeView.php, View.php, Helper.php, MediaView.php, CakeResponse.php and no luck. 

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

Re: Spaces in Filenames (Theme / Themed / Upgrade Cake 1.3 to Cake 2.0)

I don't believe symlink will be possible (or at a minimum would be a big annoyance) because I run an unlimited number of apps from custom directories and each one contains its own theme directory.   I would much rather just figure out where to do something like... 

$fileName = str_replace('%20', ' ', $fileName); 

...to get it to show, but can't find where to do that in the core.  I tried ThemeView.php, View.php, Helper.php, MediaView.php, CakeResponse.php and no luck. 

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

Re: How to show different text in a view depending on the has_many association

I'd do some parsing in the model before sending the data to the view. Not sure how your data is set up, but my instinct would be to not include the favourites in the find, then find them separately. Then either parse over the favourites array or use Set::extract, then set a new field in the Post key to false by default and set it to true where appropriate. Then in you view you have a true/false flag right where you need it without any logic.

Jeremy Burns

On 1 Dec 2011, at 00:04, andrewperk wrote:

Hello, I'm having a hard time displaying different text in a view
depending on if a user who is logged in has marked the post as a
favorite or not.

Users can have many posts, posts belong to users.
Users can have many favorites, favorites belong to users and posts.

In my index view I loop through all posts and display the post.

Inside that I loop, I then loop through all the favorites of that
post. Remember sometimes a post may not have any favorites so the
$post['Favorite] array might be empty. I want to display different
text if the post is a favorite of the logged in user. I do this by
comparing the current favorite's user_id to the logged in user's id.

Where I run into problems is when a post is marked as a favorite by 2
or more users. When this happens the Favorite array for the post
associations contains multiple users and thus I end up with both of my
different texts being displayed instead of just one or the other.

So if the post is a favorite I want to tell the user its already their
favorite.

If the post is not a favorite, I want to display a button so they can
add it as a favorite.

And if they are not logged in, they get a link describing to them what
favorites are.

Here's my view code:


*******************************

<?php foreach ($posts as $post): ?>
<?php
   // Check for logged in user
   if ($logged_in): ?>
      // Loop through the posts favorites
       <?php foreach($post['Favorite'] as $favorite): ?>
             <?php
                    // If favorite matches user id tell them its a
favorite
    if ($favorite['user_id'] == $current_user['id']): ?>
           ***** ITS YOUR FAVORITE!!!! *****
           <?php
           else: ?>
               *** BUTTON TO ADD TO FAVORITES ***
           <?php endif; ?>
      <?php endforeach; ?>
<?php
// Favorites array might be empty
if (empty($post['Favorite'])): ?>
  *** BUTTON TO ADD TO FAVORITES ***
<?php endif; ?>
<?php else: ?>
   // No logged in user. Display link to describe what favorites are
   *** LINK Favorites Description ***
<?php endif; ?>

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

Re: Spaces in Filenames (Theme / Themed / Upgrade Cake 1.3 to Cake 2.0)

This won't affect your theme assets if you follow the book, and symlink them to your web root: http://book.cakephp.org/2.0/en/views/themes.html?highlight=symlink#increasing-performance-of-plugin-and-theme-assets


"
it's recommended that you either symlink or copy out plugin/theme assets to directories in app/webroot with paths matching those used by cakephp.
  • app/Plugin/DebugKit/webroot/js/my_file.js becomes app/webroot/DebugKit/js/my_file.js
  • app/View/Themed/Navy/webroot/css/navy.css becomes app/webroot/theme/Navy/css/navy.css
"


Cheers,
Graham Weldon
http://grahamweldon.com
e. graham@grahamweldon.com
p. (+61) 0407 017 293
Skype: grahamweldon

On Thursday, 1 December 2011 at 4:43 PM, zuha wrote:

Okay so I've hit a problem and I have no idea how to fix it.  In Cake 1.3 a file name like /theme/default/images/my image.jpg would work.  In Cake2.0 the url changes to a standard url in the browser address bar (ie. /theme/default/images/my%20image.jpg - with the space replaced with %20). 

So now I have hundreds if not thousands of image files, and some have spaces in them, and they're all broken.   Because Cake no longer knows the file is there. 

Please note, this does not effect files in the app/webroot directory, but only in the theme directory (aka.  /app/View/Themed/Default/webroot/)  For example /app/webroot/test test.html  will work when called by the url /test%20test.html. 

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

Spaces in Filenames (Theme / Themed / Upgrade Cake 1.3 to Cake 2.0)

Okay so I've hit a problem and I have no idea how to fix it.  In Cake 1.3 a file name like /theme/default/images/my image.jpg would work.  In Cake2.0 the url changes to a standard url in the browser address bar (ie. /theme/default/images/my%20image.jpg - with the space replaced with %20). 

So now I have hundreds if not thousands of image files, and some have spaces in them, and they're all broken.   Because Cake no longer knows the file is there. 

Please note, this does not effect files in the app/webroot directory, but only in the theme directory (aka.  /app/View/Themed/Default/webroot/)  For example /app/webroot/test test.html  will work when called by the url /test%20test.html. 

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

Re: Send Email problem with multiple receivers

What CakePHP version are you on?

Cheers,
Graham Weldon
http://grahamweldon.com
e. graham@grahamweldon.com
p. (+61) 0407 017 293
Skype: grahamweldon

On Thursday, 1 December 2011 at 4:20 PM, MetZ wrote:

Hi..
Tried it, did not work either, only the first email in array get the
email.

Any other suggestions??

-Tom

On 1 Des, 06:03, Graham Weldon <predomin...@gmail.com> wrote:
Have you tried an array of email address?

$this->Email->to = array('du...@rmail.com', 'du...@email.com');

Cheers,
Graham Weldonhttp://grahamweldon.com
p. (+61) 0407 017 293
Skype: grahamweldon







On Thursday, 1 December 2011 at 4:02 PM, MetZ wrote:
Hi all!

I am having a problem, when sending email with multiple reveivers in
$this->Email->to

It will only send to one adress (the first one =>
email_numb...@gmail.com (mailto:email_numb...@gmail.com)), why is that? any suggestions!?!

$this->Email->to = 'email_numb...@gmail.com (mailto:email_numb...@gmail.com), email_numb...@gmail.com (mailto:email_numb...@gmail.com)';
$this->Email->subject = 'Ma Subject!';
$this->Email->from = Configure::read('App.noreply');
$this->Email->template = 'new_notify';
$this->Email->sendAs = 'both';
$this->Email->send();
$this->Email->reset();

--
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

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

Re: Send Email problem with multiple receivers

Hi..
Tried it, did not work either, only the first email in array get the
email.

Any other suggestions??

-Tom

On 1 Des, 06:03, Graham Weldon <predomin...@gmail.com> wrote:
> Have you tried an array of email address?
>
> $this->Email->to = array('du...@rmail.com', 'du...@email.com');
>
> Cheers,
> Graham Weldonhttp://grahamweldon.com
> e. gra...@grahamweldon.com
> p. (+61) 0407 017 293
> Skype: grahamweldon
>
>
>
>
>
>
>
> On Thursday, 1 December 2011 at 4:02 PM, MetZ wrote:
> > Hi all!
>
> > I am having a problem, when sending email with multiple reveivers in
> > $this->Email->to
>
> > It will only send to one adress (the first one =>
> > email_numb...@gmail.com (mailto:email_numb...@gmail.com)), why is that? any suggestions!?!
>
> > $this->Email->to = 'email_numb...@gmail.com (mailto:email_numb...@gmail.com), email_numb...@gmail.com (mailto:email_numb...@gmail.com)';
> > $this->Email->subject = 'Ma Subject!';
> > $this->Email->from = Configure::read('App.noreply');
> > $this->Email->template = 'new_notify';
> > $this->Email->sendAs = 'both';
> > $this->Email->send();
> > $this->Email->reset();
>
> > --
> > 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+unsubscribe@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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: Send Email problem with multiple receivers

Have you tried an array of email address?

$this->Email->to = array('dude1@rmail.com', 'dude2@email.com');



Cheers,
Graham Weldon
http://grahamweldon.com
e. graham@grahamweldon.com
p. (+61) 0407 017 293
Skype: grahamweldon

On Thursday, 1 December 2011 at 4:02 PM, MetZ wrote:

Hi all!

I am having a problem, when sending email with multiple reveivers in
$this->Email->to

It will only send to one adress (the first one =>
email_number1@gmail.com), why is that? any suggestions!?!

$this->Email->subject = 'Ma Subject!';
$this->Email->from = Configure::read('App.noreply');
$this->Email->template = 'new_notify';
$this->Email->sendAs = 'both';
$this->Email->send();
$this->Email->reset();

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

Send Email problem with multiple receivers

Hi all!

I am having a problem, when sending email with multiple reveivers in
$this->Email->to

It will only send to one adress (the first one =>
email_number1@gmail.com), why is that? any suggestions!?!

$this->Email->to = 'email_number1@gmail.com, email_number2@gmail.com';
$this->Email->subject = 'Ma Subject!';
$this->Email->from = Configure::read('App.noreply');
$this->Email->template = 'new_notify';
$this->Email->sendAs = 'both';
$this->Email->send();
$this->Email->reset();

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

Re: How to show different text in a view depending on the has_many association

Your code is quite messy...

Anyways:

<?php
foreach($posts as $post){//loop trough posts
if ($logged_in){//check if the user is logged in
if(!empty($post['Favorite'])){//check if favorites is
empty
$flag = 0;//initialize flag
foreach($post['Favorite'] as $favorite){ //loop trough
favorites
if ($favorite['user_id'] == $current_user['id'])//
if logged in user id is in favorites, increment flag
$flag += 1;
}
echo $favorite = $flag == 0 ? 'BUTTON TO ADD TO
FAVORITES' : 'ITS YOUR FAVORITE';//echo the corresponding link
} else {//Favorites is empty
/*****BUTTON TO ADD TO FAVORITES******/
}
} else {//User is not logged in
// No logged in user. Display link to describe what
favorites are
}
}
?>

Hope this helps...

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

Re: cakephp select option stored as 0 in database instead of selected value

I figured it out... I had to manually give me select 'name' =>
'data[Student][period_id]', and 'id' => 'StudentPeriodId'. I'm sure
I've strayed from cake's naming conventions a bit, thats why it didn't
hook up automatically.

On Nov 30, 3:53 pm, GG <jairusk...@gmail.com> wrote:
> When I change it to period_id the entire select box disappears.
>
> See how in the source code, it populates the correct information, but
> when it submits, the "option value" doesn't get sent to the correct
> field. It actually doesn't get sent anywhere. After submit, my table
> has a new entry that looks like:
>
> period_id:0
> user:_id:14 (the correct user)
>
> On Nov 30, 3:39 pm, euromark <dereurom...@googlemail.com> wrote:
>
>
>
>
>
>
>
> > I guess you made a mistake in your form
> > why is it not echo $this->Form->input('period_id');
> > (note the _id)?
>
> > tip:
> > let cake bake your code. this way less mistakes can be made and such
> > as above easily be avoided
>
> > On 1 Dez., 00:09, GG <jairusk...@gmail.com> wrote:
>
> > > The form is successfully adding a new entry to the table, the user_id
> > > is correct, however, the period_id is being stored as 0. They are both
> > > int(11).
>
> > > Problem:::: I need to tell cake to: store the value of the option
> > > being sent into the period_id column.
> > > Solution::::?????? Thanks for your help!
>
> > > Here is my database
>
> > > name:students
> > > field1:period_id
> > > field2:user_id
>
> > > Here is my StudentsController.php
>
> > >  public function add() {
> > >     if ($this->request->is('post')) {
> > >         $this->request->data['Student']['user_id'] = $this->Auth->user('id');
>
> > >         if ($this->Student->save($this->request->data)) {
> > >             $this->Session->setFlash('Class successfully added.');
> > >             $this->redirect(array('action' => 'index'));
> > >         }
> > >     }
>
> > >     $periods = $this->Period->find('list');
> > >     $this->set(compact('periods'));
>
> > > }
>
> > > Here is my add.ctp View
>
> > > echo $this->Form->create('Student');
> > > echo $this->Form->input('period');
> > > echo $this->Form->end('Add Class');
>
> > > Here is the source code from Students/add
>
> > > <div class="input select"><label for="StudentPeriod">Period</label>
> > > <select name="data[Student][period]" id="StudentPeriod">
> > > <option value="57">Class 1</option>
> > > <option value="56">Class 2</option>
> > > <option value="52">Class 3</option>
> > > <option value="51">Class 4</option>
> > > <option value="59">Class 5</option>
> > > </select>
> > > </div>

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

How to show different text in a view depending on the has_many association

Hello, I'm having a hard time displaying different text in a view
depending on if a user who is logged in has marked the post as a
favorite or not.

Users can have many posts, posts belong to users.
Users can have many favorites, favorites belong to users and posts.

In my index view I loop through all posts and display the post.

Inside that I loop, I then loop through all the favorites of that
post. Remember sometimes a post may not have any favorites so the
$post['Favorite] array might be empty. I want to display different
text if the post is a favorite of the logged in user. I do this by
comparing the current favorite's user_id to the logged in user's id.

Where I run into problems is when a post is marked as a favorite by 2
or more users. When this happens the Favorite array for the post
associations contains multiple users and thus I end up with both of my
different texts being displayed instead of just one or the other.

So if the post is a favorite I want to tell the user its already their
favorite.

If the post is not a favorite, I want to display a button so they can
add it as a favorite.

And if they are not logged in, they get a link describing to them what
favorites are.

Here's my view code:


*******************************

<?php foreach ($posts as $post): ?>
<?php
// Check for logged in user
if ($logged_in): ?>
// Loop through the posts favorites
<?php foreach($post['Favorite'] as $favorite): ?>
<?php
// If favorite matches user id tell them its a
favorite
if ($favorite['user_id'] == $current_user['id']): ?>
***** ITS YOUR FAVORITE!!!! *****
<?php
else: ?>
*** BUTTON TO ADD TO FAVORITES ***
<?php endif; ?>
<?php endforeach; ?>
<?php
// Favorites array might be empty
if (empty($post['Favorite'])): ?>
*** BUTTON TO ADD TO FAVORITES ***
<?php endif; ?>
<?php else: ?>
// No logged in user. Display link to describe what favorites are
*** LINK Favorites Description ***
<?php endif; ?>

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

Re: cakephp select option stored as 0 in database instead of selected value

When I change it to period_id the entire select box disappears.

See how in the source code, it populates the correct information, but
when it submits, the "option value" doesn't get sent to the correct
field. It actually doesn't get sent anywhere. After submit, my table
has a new entry that looks like:

period_id:0
user:_id:14 (the correct user)

On Nov 30, 3:39 pm, euromark <dereurom...@googlemail.com> wrote:
> I guess you made a mistake in your form
> why is it not echo $this->Form->input('period_id');
> (note the _id)?
>
> tip:
> let cake bake your code. this way less mistakes can be made and such
> as above easily be avoided
>
> On 1 Dez., 00:09, GG <jairusk...@gmail.com> wrote:
>
>
>
>
>
>
>
> > The form is successfully adding a new entry to the table, the user_id
> > is correct, however, the period_id is being stored as 0. They are both
> > int(11).
>
> > Problem:::: I need to tell cake to: store the value of the option
> > being sent into the period_id column.
> > Solution::::?????? Thanks for your help!
>
> > Here is my database
>
> > name:students
> > field1:period_id
> > field2:user_id
>
> > Here is my StudentsController.php
>
> >  public function add() {
> >     if ($this->request->is('post')) {
> >         $this->request->data['Student']['user_id'] = $this->Auth->user('id');
>
> >         if ($this->Student->save($this->request->data)) {
> >             $this->Session->setFlash('Class successfully added.');
> >             $this->redirect(array('action' => 'index'));
> >         }
> >     }
>
> >     $periods = $this->Period->find('list');
> >     $this->set(compact('periods'));
>
> > }
>
> > Here is my add.ctp View
>
> > echo $this->Form->create('Student');
> > echo $this->Form->input('period');
> > echo $this->Form->end('Add Class');
>
> > Here is the source code from Students/add
>
> > <div class="input select"><label for="StudentPeriod">Period</label>
> > <select name="data[Student][period]" id="StudentPeriod">
> > <option value="57">Class 1</option>
> > <option value="56">Class 2</option>
> > <option value="52">Class 3</option>
> > <option value="51">Class 4</option>
> > <option value="59">Class 5</option>
> > </select>
> > </div>

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

Re: cakephp select option stored as 0 in database instead of selected value

I guess you made a mistake in your form
why is it not echo $this->Form->input('period_id');
(note the _id)?

tip:
let cake bake your code. this way less mistakes can be made and such
as above easily be avoided


On 1 Dez., 00:09, GG <jairusk...@gmail.com> wrote:
> The form is successfully adding a new entry to the table, the user_id
> is correct, however, the period_id is being stored as 0. They are both
> int(11).
>
> Problem:::: I need to tell cake to: store the value of the option
> being sent into the period_id column.
> Solution::::?????? Thanks for your help!
>
> Here is my database
>
> name:students
> field1:period_id
> field2:user_id
>
> Here is my StudentsController.php
>
>  public function add() {
>     if ($this->request->is('post')) {
>         $this->request->data['Student']['user_id'] = $this->Auth->user('id');
>
>         if ($this->Student->save($this->request->data)) {
>             $this->Session->setFlash('Class successfully added.');
>             $this->redirect(array('action' => 'index'));
>         }
>     }
>
>     $periods = $this->Period->find('list');
>     $this->set(compact('periods'));
>
> }
>
> Here is my add.ctp View
>
> echo $this->Form->create('Student');
> echo $this->Form->input('period');
> echo $this->Form->end('Add Class');
>
> Here is the source code from Students/add
>
> <div class="input select"><label for="StudentPeriod">Period</label>
> <select name="data[Student][period]" id="StudentPeriod">
> <option value="57">Class 1</option>
> <option value="56">Class 2</option>
> <option value="52">Class 3</option>
> <option value="51">Class 4</option>
> <option value="59">Class 5</option>
> </select>
> </div>

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

Is this it?

is this the only official forum type chat there is for CakePHP?
this framework is one of the most popular frameworks there is and they
don't have there own forum?
am I missing something.

David

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

cakephp select option stored as 0 in database instead of selected value

The form is successfully adding a new entry to the table, the user_id
is correct, however, the period_id is being stored as 0. They are both
int(11).

Problem:::: I need to tell cake to: store the value of the option
being sent into the period_id column.
Solution::::?????? Thanks for your help!

Here is my database

name:students
field1:period_id
field2:user_id


Here is my StudentsController.php

public function add() {
if ($this->request->is('post')) {
$this->request->data['Student']['user_id'] = $this->Auth-
>user('id');
if ($this->Student->save($this->request->data)) {
$this->Session->setFlash('Class successfully added.');
$this->redirect(array('action' => 'index'));
}
}

$periods = $this->Period->find('list');
$this->set(compact('periods'));


}

Here is my add.ctp View

echo $this->Form->create('Student');
echo $this->Form->input('period');
echo $this->Form->end('Add Class');


Here is the source code from Students/add

<div class="input select"><label for="StudentPeriod">Period</label>
<select name="data[Student][period]" id="StudentPeriod">
<option value="57">Class 1</option>
<option value="56">Class 2</option>
<option value="52">Class 3</option>
<option value="51">Class 4</option>
<option value="59">Class 5</option>
</select>
</div>


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

Re: Amazon SES and CakePHP 2

http://bakery.cakephp.org/articles/dankroad/2011/01/30/integrate_amazon_simple_email_service_ses_into_existing_application


On Dec 1, 12:18 am, toby1kenobi <toby.math...@gmail.com> wrote:
> Hi there,
>
>   Has anyone got the Amazon SES PHP SDK working in CakePHP 2? I had it
> installed in 1.3, but I can't seem to figure out how you do the
> equivalent of:
>
> App::import('Vendor', 'AmazonSES', array('file' => 'amazon' . DS .
> 'sdk.class.php'));
>
>   in the new version (the above is what I did to make the AmazonSES
> PHP wrapper available in the previous version of Cake). I've tried a
> number of variations of the above, and App:build and App:uses, but
> haven't found the right combination yet.
>
>   Thanks,
>
> Toby

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

Re: js/css compression helpers for cakephp 2.0

I only thing I am wondering about that plugin is, whether it supports
assert compression by using the default
$this->Html->css/script syntax
Or if one would have to completely rewrite all views/layouts here. (to
$this->AssetCompress->...)
From the look into the code and docs it seems this is necessary (no
beforeRender hook to catch them and automatically process them if the
helper is included etc).


On 30 Nov., 20:46, mikeottinger <mikeottin...@gmail.com> wrote:
> Thanks guys, I'll give Mark Story's plugin a try
> (https://github.com/markstory/asset_compress/tree/2.0). This supports YUI
> Compression which I was particularly looking for. Thanks for the info.

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

Amazon SES and CakePHP 2

Hi there,

Has anyone got the Amazon SES PHP SDK working in CakePHP 2? I had it
installed in 1.3, but I can't seem to figure out how you do the
equivalent of:

App::import('Vendor', 'AmazonSES', array('file' => 'amazon' . DS .
'sdk.class.php'));

in the new version (the above is what I did to make the AmazonSES
PHP wrapper available in the previous version of Cake). I've tried a
number of variations of the above, and App:build and App:uses, but
haven't found the right combination yet.

Thanks,

Toby

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

Re: js/css compression helpers for cakephp 2.0

Thanks guys, I'll give Mark Story's plugin a try (https://github.com/markstory/asset_compress/tree/2.0). This supports YUI Compression which I was particularly looking for. Thanks for the info.

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

Re: Has many problem


Hugo Massaroli


2011/11/30 phpMagpie <paul@webbedit.co.uk>
Option 2 does not look normalized to me as data1, data2, data3 should be in an associated table Process hasMany Data <-> Data belongsTo Process.

It's normalized because data1, data2 and data3 are always the same fields, they don't change with the process :)

 

When editing you echo each records id and therefore the save call will update the correct record.  
echo $this->Form->input("Process.0.id");
echo $this->Form->input("Process.0.process_name");
echo $this->Form->input("Process.0.cost_type");

Thanks! I've got the idea. If I respect the order problems shouldn't appear :)

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

Re: Installation CakePHP 2.0n on a shared host

I have exactly the same problem. Is there any solution?

On 3 Nov., 08:46, berni <b.frerichm...@googlemail.com> wrote:
> Hello all
>
> After messing up with the installation of CakePHP 2.0x in aSharedHostingenvironement,
> searching for solutions and playing around with different suggestions,
> that did not
> appear as a solution, I tried to catch the real problem.
>
> Ok. That's now my way to ask for a solution
>
> 1.  I installed both branches :  1.3.13 and 2.01 onto the the Host
>
> 2.  I put a copy of default home.ctp into my app/view/pages and
> changed the
>     original a little bit to print out the settings instead of the
> links
>     given in the original.
>
> 3.  I changed the three .htaccess adding RewriteBase as suggested by
> Cake
>     so the only difference between them is the last RewriteRule
> showing
>     index.php?url=$1 in version 1.3.13
>     index.php?/$1    in version 2.0.1
>
> 4.  I set my domainroot in both cases to : mydomain/app/
> webroot
>
> 5.  Starting with 1.3.13 everything works fine calling either
>    www.mydomainorwww.mydomain/pages/home
>
>     Setting WWW_ROOT : path-to-cake13/app/webroot/
>     Setting ROOT : path-to-cake13
>     Setting APP_DIR : app
>     Setting WEBROOT_DIR : webroot
>     Setting CORE_PATH :
>     Setting CAKE_CORE_INCLUDE_PATH : path-to-cake13
>     Setting include_path : path-to-cake13:path-to-cake13/app/:.:/usr/
> local/lib/php
>
> 6.  Starting with 2.0.1 it's getting weird
>
>    www.mydomainis ok  showing these settings
>
>     Setting WWW_ROOT : path-to-cake20/app/webroot/
>     Setting ROOT : path-to-cake20
>     Setting APP_DIR : app
>     Setting WEBROOT_DIR : webroot
>     Setting CORE_PATH : path-to-cake20/lib/
>     Setting CAKE_CORE_INCLUDE_PATH : path-to-cake20/lib
>     Setting include_path : path-to-cake20/lib:.:/usr/local/lib/
> php
>
>    www.mydomain/pages/home comes up with Missing Controller Message
>
>     looking at the source of the generated html, I found this for
> example
>
>         <link href="/pages/favicon.ico" type="image/x-icon" rel="icon" />
>     <link href="/pages/favicon.ico" type="image/x-icon" rel="shortcut
> icon" />
>     <link rel="stylesheet" type="text/css" href="/pages/css/
> cake.generic.css" /></head>
>
> In my opinion the change from Url to Path had some implications that
> are not yet
> reflected through all of your code. But you are the one, that can find
> the
> real answer.
>
> Cake is great.
>
> You may help a lot of people, I think, if you can solve this problem.
> Hope my notes above are helpfull for you.
>
> Bernhard

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

Re: Installation CakePHP 2.0n on a shared host

I have exactly the same problem. Is there any solution?

On 3 Nov., 08:46, berni <b.frerichm...@googlemail.com> wrote:
> Hello all
>
> After messing up with the installation of CakePHP 2.0x in aSharedHostingenvironement,
> searching for solutions and playing around with different suggestions,
> that did not
> appear as a solution, I tried to catch the real problem.
>
> Ok. That's now my way to ask for a solution
>
> 1.  I installed both branches :  1.3.13 and 2.01 onto the the Host
>
> 2.  I put a copy of default home.ctp into my app/view/pages and
> changed the
>     original a little bit to print out the settings instead of the
> links
>     given in the original.
>
> 3.  I changed the three .htaccess adding RewriteBase as suggested by
> Cake
>     so the only difference between them is the last RewriteRule
> showing
>     index.php?url=$1 in version 1.3.13
>     index.php?/$1    in version 2.0.1
>
> 4.  I set my domainroot in both cases to : mydomain/app/
> webroot
>
> 5.  Starting with 1.3.13 everything works fine calling either
>    www.mydomainorwww.mydomain/pages/home
>
>     Setting WWW_ROOT : path-to-cake13/app/webroot/
>     Setting ROOT : path-to-cake13
>     Setting APP_DIR : app
>     Setting WEBROOT_DIR : webroot
>     Setting CORE_PATH :
>     Setting CAKE_CORE_INCLUDE_PATH : path-to-cake13
>     Setting include_path : path-to-cake13:path-to-cake13/app/:.:/usr/
> local/lib/php
>
> 6.  Starting with 2.0.1 it's getting weird
>
>    www.mydomainis ok  showing these settings
>
>     Setting WWW_ROOT : path-to-cake20/app/webroot/
>     Setting ROOT : path-to-cake20
>     Setting APP_DIR : app
>     Setting WEBROOT_DIR : webroot
>     Setting CORE_PATH : path-to-cake20/lib/
>     Setting CAKE_CORE_INCLUDE_PATH : path-to-cake20/lib
>     Setting include_path : path-to-cake20/lib:.:/usr/local/lib/
> php
>
>    www.mydomain/pages/home comes up with Missing Controller Message
>
>     looking at the source of the generated html, I found this for
> example
>
>         <link href="/pages/favicon.ico" type="image/x-icon" rel="icon" />
>     <link href="/pages/favicon.ico" type="image/x-icon" rel="shortcut
> icon" />
>     <link rel="stylesheet" type="text/css" href="/pages/css/
> cake.generic.css" /></head>
>
> In my opinion the change from Url to Path had some implications that
> are not yet
> reflected through all of your code. But you are the one, that can find
> the
> real answer.
>
> Cake is great.
>
> You may help a lot of people, I think, if you can solve this problem.
> Hope my notes above are helpfull for you.
>
> Bernhard

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

Re: Form input Automagic on hasAndBelongsToMany when the model is not the model for the form?

Also to clarfiy, I have dumped $this->data at the view load time and have verified that all the data needed for the automagic population is present.  So the problem is not at the query level, but would appear to be at the Helper level.

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

Re: Form input Automagic on hasAndBelongsToMany when the model is not the model for the form?

Thank you for answering.  I was afraid the association might be too deep.

Just to clarify one thing, the model is not named Session, I was just trying to describe the nature of my problem using model names here that would make more sense to people not intimately familiar with the project.

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

Re: Blog with posts and comments

Thank you euromark but the console not create a nice posts with
comments. I need a little code example how to do it. :-)

On 30 nov, 12:19, euromark <dereurom...@googlemail.com> wrote:
> please take a lot at the book starting right about here:http://book.cakephp.org/2.0/en/console-and-shells/code-generation-wit...
>
> On 30 Nov., 17:15, joserafael <josecam...@gmail.com> wrote:
>
>
>
>
>
>
>
> > No, the blog tutorial cover only post. I dont know who to do it
>
> > On 30 nov, 07:12, phpMagpie <p...@webbedit.co.uk> wrote:
>
> > > Does the blog tutorial not cover all of 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: cakephp ecommerce work

Did you ever get someone to help you with this?

Simon

--
View this message in context: http://cakephp.1045679.n5.nabble.com/cakephp-ecommerce-work-tp4634234p5036192.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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

HABTM & read.

Hi !
I have a little problem with the HABTM associations.

Group hasManyAndBelongsTo Lesson
Lesson hasManyAndBelongsTo Group

Groups
groups.id | groups.name | ...

Lessons
lessons.id | lessons.title | ...

Groups_Lessons
groups_lessons.id | groups_lessons.lesson_id | groups_lessons.group_id

I have write this the Lesson model :

class Lesson extends AppModel {
public $name = 'Lesson';
public $hasAndBelongsToMany = array(
        'Groups' =>
            array(
                'className'              => 'Group',
                'joinTable'              => 'groups_lessons',
                'foreignKey'             => 'lesson_id',
                'associationForeignKey'  => 'group_id'
            )
    );
}

and this Group model :

class Group extends AppModel {
public $name = 'Group';

public $hasAndBelongsToMany = array(
        'Lessons' =>
            array(
                'className'              => 'Lesson',
                'joinTable'              => 'groups_lessons',
                'foreignKey'             => 'group_id',
                'associationForeignKey'  => 'lesson_id',
            )
    );

}

In the index of my lesson controller, I realize a $this->Lesson->find('all') call.
I have 2 SQL query :

SELECT "Lesson"."id" AS "Lesson__id", "Lesson"."teacher_id" AS "Lesson__teacher_id", "Lesson"."entitled" AS "Lesson__entitled", "Lesson"."abbreviation" AS "Lesson__abbreviation", "Lesson"."hours" AS "Lesson__hours", "Lesson"."option" AS "Lesson__option" FROM "lessons" AS "Lesson" WHERE 1 = 1

> One row 

SELECT "Groups"."id" AS "Groups__id", "Groups"."holder_id" AS "Groups__holder_id", "Groups"."education_id" AS "Groups__education_id", "Groups"."name" AS "Groups__name", "Groups"."abbreviation" AS "Groups__abbreviation", "GroupsLesson"."id" AS "GroupsLesson__id", "GroupsLesson"."group_id" AS "GroupsLesson__group_id", "GroupsLesson"."lesson_id" AS "GroupsLesson__lesson_id" FROM "groups" AS "Groups" JOIN "groups_lessons" AS "GroupsLesson" ON ("GroupsLesson"."lesson_id" = 1 AND "GroupsLesson"."group_id" = "Groups"."id")

> One row 

But, when I realize a print_r on  $this->Lesson->find('all'), I have no group...

Array ( [0] => Array ( [Lesson] => Array ( [id] => 1 [teacher_id] => 1 [entitled] => Math [abbreviation] => M [hours] => 14 [option] => ) [Groups] => Array ( ) ) )

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

Re: Blog with posts and comments

please take a lot at the book starting right about here:
http://book.cakephp.org/2.0/en/console-and-shells/code-generation-with-bake.html?highlight=bake

On 30 Nov., 17:15, joserafael <josecam...@gmail.com> wrote:
> No, the blog tutorial cover only post. I dont know who to do it
>
> On 30 nov, 07:12, phpMagpie <p...@webbedit.co.uk> wrote:
>
>
>
>
>
>
>
> > Does the blog tutorial not cover all of 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: Blog with posts and comments

I use in the console "cake bake" all the time. The relation Has Many
and Belongs To is Ok. But when create a new comment I must to select
the post in a select field and no directly. This way is not elegant
and functional.

On 29 nov, 16:54, euromark <dereurom...@googlemail.com> wrote:
> you shoudnt use "scaffolding" but bake your code using the bake shell
> then you probably discover that all your problems are gone
>
> On 29 Nov., 16:55, joserafael <josecam...@gmail.com> wrote:
>
>
>
>
>
>
>
> > If anything I could do in cakephp is to relate a table of news with
> > commentary. Yes, that is simple but I can not find the solution.
>
> > When I make the scaffold I have no problem. The hasMany and belongsTo
> > is created in the model. But when I select a comment post via a
> > dropdown menu and it is not functional.
>
> > The same happens when I add a photo that I use this drop-down menu to
> > find the post to which he belongs.
>
> > I wish someone would publish a code in order to guide me. Otherwise
> > that's what I put in the controller and in the view that automatically
> > make a comment related to the news. I'll be very grateful.

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

Re: Blog with posts and comments

No, the blog tutorial cover only post. I dont know who to do it

On 30 nov, 07:12, phpMagpie <p...@webbedit.co.uk> wrote:
> Does the blog tutorial not cover all of 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: Write unit test for a controller that uses AuthComponent in CakePHP 2.0.3

I have posted this question in StackOverflow and Jose Lorenzo answered
me this:

"The actual correct answer should be using mock objects instead of
actually login the user in manually:

$this->controller = $this->generate('Users', array(
'components' => array('Auth' => array('user')) //We mock the
Auth Component here
));
$this->controller->Auth->expects($this->once())->method('user') //
The method user()
->with('id') //Will be called with first param 'id'
->will($this->returnValue(2)) //And will return something for
me
$this->testAction('/users/edit/2', array('method' => 'get'));"

He is actually right but I'm still having problem when dealings with
models. For example, suppose I am testing an action that uses `save`
and `create` methods of a model. I tried to configure the expectations
like this:

$this->Users->User->expects($this->once())->with('save')->will($this-
>returnValue(true));
$this->testAction('/signup', array('data' => $data));

The action actually calls `save` to create a new User, but PHPUnit
says that it was never called. I have created `$this->Users`
controller in `ControllerTestCase::setUp()` like this:

$this->Users = $this->generate('Users', array(
'components' => array('Session', 'Auth' => array('user'))
'models' => 'User'
));

According to documentation, not passing any arguments to a mocked
models implies every method is stubbed. So what am I doing wrong here?

Thanks!

On Nov 23, 1:25 pm, Shukuboy <shuku...@gmail.com> wrote:
> The only thing I can suggest is to add the mocked method to your
> generate function :
>
> $this->Users = $this->generate('Users', array(      'components'
> => array('Session', 'Auth' => array('user') )    ));
>
> Not sure if it would mock the method otherwise.
>
> On Nov 23, 6:13 am,elitalon<elita...@gmail.com> wrote:
>
>
>
>
>
>
>
> > I am using the ControllerTestCase, so I have modified the generated
> > controller using the following code, which is a slightly modified
> > version of your suggested approach:
> >     $this->Users = $this->generate('Users', array(      'components'
> > => array('Session', 'Auth')    ));    $this->Users->Auth->expects($this->once())      ->method('user')      ->with('id')      -
> > >will($this->returnValue(1));
>
> > But it still fails. I completely agree with AuthComponent being
> > inconsisten between the website usage and testing. I have flagged a
> > ticket and I'm in discussion with Mark Story about that.
> > On Nov 22, 7:04 pm, Shukuboy <shuku...@gmail.com> wrote:
>
> > > Hi,
>
> > > I've also had to deal with testing controllers that use Auth
> > > lately.    Auth has improved heaps since 1.3 but it still seems to be
> > > coupled with various bits and pieces of the core, and hence you might
> > > get different behaviours between the website and testing.
>
> > > I recommend mocking out Auth and getting it to return the value you
> > > expect, in this case if your logged in user is 1, you can use
> > > something like this :
> > > $Users->Auth->expects($this->once())->method('user')
> > >        -> with( 'id' )
> > >         ->will($this->returnValue(1));
>
> > > Check out
> > > -http://book.cakephp.org/2.0/en/development/testing.html#using-mocks-w...
> > > and if you need more info on phpunit :
> > > -http://www.phpunit.de/manual/current/en/test-doubles.html#test-double...
>
> > > The new move to phpunit in Cake 2, was a great idea.  It's quite
> > > powerful and allows you to do almost everything you need while unit
> > > testing.
>
> > > Hope this helps,
> > > Shuku

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

Re: Creating a mocked model uses default database instead of test in PHPUnit

It worked, but in addition I have to set the model alias:

$this->User->alias = 'User';

because a simple `$this->User->read(null, 1)` raised an error saying
that 'User.a_column' couldn't be found.


On Nov 24, 3:22 pm, José Lorenzo <jose....@gmail.com> wrote:
> When mocking a model it is recommended that you pass the correct parameters
> to the contstructor:
>
> $this->User = $this->getMock('User', array('_saveUploadedFile', '_removeUploadedFile'),
> array(false, 'users', 'test'));
>
> The third parameter indicates that you want to use the 'users' table and
> the 'test' datasource for your mock object. That is what CakePHP internally
> does when you instantiate a new model in your tests using
> ClassRegistry::init()

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

Re: CakeEmail & Invalid email

a) you dont have to submit it to cake
if you really want to go down that road, build your own class and put
it in
/app/Lib/Network/Email/
CakePHP will then use your custom class instead

b) if you wont to know if it works, try it - but I woudn't recommend
it


On 30 Nov., 06:32, localhost <ahm...@gmail.com> wrote:
> No suggestion from anyone! :(
>
> Should I modify CakeMail to make mail validation an option and submit
> this to Cakephp ?
>
> OR
>
> if I add the "To" field" direct to the mail header (using addheader
> function), do you think it will work?
>
> On Nov 29, 7:23 am, localhost <ahm...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Thank you very much for the suggestion but really I don't have this
> > option
>
> > I just need to disable the email validation in cakemail
>
> > On Nov 29, 1:29 am, Justin Edwards <justinledwa...@gmail.com> wrote:
>
> > > I would rather fix your exchange rules to follow a standard.  Microsoft
> > > could fix their product (stop allowing invalid addresses) and you could
> > > have problems in the future.
>
> > > On Mon, Nov 28, 2011 at 3:42 PM, localhost <ahm...@gmail.com> wrote:
> > > > Hi
>
> > > > If you try to send email using CakeEmail in cakephp 2, CakeEmail will
> > > > check the "To" email and give you error for invalid emails.
>
> > > > my question is how to disable this validation, I actually want to send
> > > > wrong email format :)  I have my SMTP (MS Exchange) configured to
> > > > forward any email with predefined format (not correct email format) to
> > > > some internal application.
>
> > > > So currently I'm trying to send email to "[fax:NAME@456789098]"   ,
> > > > any idea how to disable CakeEmail email validation ?
>
> > > > --
> > > > 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+unsubscribe@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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: Conditions in model associations

you could probably wright a behavior which could "correct" the issue
at runtime
until it is fixed in the not so near future :)


On 30 Nov., 06:59, Jeremy Burns | Class Outfit
<jeremybu...@classoutfit.com> wrote:
> Thanks - this is exactly the issue I am facing. I agree with you; this sort of renders the conditional associations almost useless and I bet it catches a lot of people out. It took me an hour or so to realise what was happening.
>
> Jeremy Burns
> Class Outfit
>
> http://www.classoutfit.com
>
> On 29 Nov 2011, at 21:25, euromark wrote:
>
>
>
>
>
>
>
> > and I think this is the ticket:
> >http://cakephp.lighthouseapp.com/projects/42648/tickets/1793-model-co...
>
> > On 29 Nov., 22:22, euromark <dereurom...@googlemail.com> wrote:
> >> If I remember right a core member once wrote that this is a known
> >> limitation of the current "conditions array" for relations.
> >> Personally, I think this should be addressed in 2.1 as a bugfix to be
> >> fixed (if I add a global condition it should always be applied, no
> >> matter what).
>
> >> As of right now you probably need to manually join the conditions.
>
> >> On 29 Nov., 18:16, Jeremy Burns <jeremybu...@classoutfit.com> wrote:
>
> >>> I've noticed that if I have conditions on model associations, for
> >>> example:
>
> >>> $hasMany = array(
> >>>         'ActiveUser' => array(
> >>>                 'className' => 'User',
> >>>                 'foreignKey' => 'group_id',
> >>>                 'conditions' => array(
> >>>                         'ActiveUser.active' => 1
> >>>                 )
> >>>         )
> >>> );
>
> >>> ...and bring that key into a find BUT with an added condition, for
> >>> example;
>
> >>> $groups = $this->find(
> >>>         'all',
> >>>         array(
> >>>                 'contain' => array(
> >>>                         'ActiveUser' => array(
> >>>                                 'conditions' => array(
> >>>                                         'ActiveUser.id' => 10
> >>>                                 )
> >>>                         )
> >>>                 )
> >>>         )
> >>> );
>
> >>> ...the condition on the join is ignored. So in this example the user
> >>> with an id of 10 will come back whether he is active or not.
>
> >>> How do I overcome that?
>
> > --
> > 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+unsubscribe@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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: can i have two login?

Same user, same browser - different roles at the same time :)

You can create kind of impersonation  $this->Auth->login($this->data);

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