Re: Issue with Form Helper array('type' => 'file')

2012-02-23 Thread jeremyharris
What behaviors are you using besides Transfer? Coupler tends to mess with 
the data because it expects *just* the fields in the Media.Attachment 
model. Try removing Coupler if it's attached (since you're not using it).

Also, unit tests are your friend. It would be much easier to try things and 
debug using unit tests rather than not.

-- 
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: CakePHP Multiple field search with ALL fields being OPTIONAL

2012-02-23 Thread rchavik
Use cakedc's search 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


Re: Issue with Form Helper array('type' => 'file')

2012-02-23 Thread Kro
Thanks for taking the time to reply @jeremyharris. The record is still
getting written but the 'Rate' data is missing. The following is an
example of a saved record. As you can see the 'Rate' data is missing.

Array
(
[Rate] => Array
(
[id] => 92
[id_ref] =>
[title] =>
[short_description] =>
[description] =>
[price_quote_as] =>
[adult_supplement] => 0.00
[child_supplement] => 0.00
[supplement] => 0.00
[minimum_stay] => 0
[maximum_stay] => 0
[imagefile] =>
[enabled] => 0
[special_offer] => 0
[list_no] => 0
[availability] =>
[valid_from] => -00-00 00:00:00
[valid_to] => -00-00 00:00:00
[is_corporate] => 0
[created] => -00-00 00:00:00
[updated] => -00-00 00:00:00
[deleted] => 0
[dirname] =>
[basename] =>
)

[Room] => Array
(
[0] => Array
(
[id] => 15
[title] => Deluxe Double Room
[description] => Situated in the new wing of
[min_adults] => 2
[max_adults] => 2
[max_children] => 0
[no_of_rooms] => 0
[enabled] => 1
[list_no] => 2
[created] => 2011-09-04 21:37:08
[updated] => 2011-09-05 17:00:55
[deleted] => 0
[dirname] => img
[basename] => deluxe_bedroom_2.jpg
[RatesRoom] => Array
(
[id] => 1942
[rate_id] => 92
[room_id] => 15
[dirname] =>
[basename] =>
)

)

)

[CorporateAccount] => Array
(
)

)

On Feb 23, 3:34 pm, jeremyharris  wrote:
> What do you mean by corrupted? It should fail gracefully and stop the save
> process if there's an error.

-- 
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: Handling data returned by multi-select box

2012-02-23 Thread jeremyharris
It sounds like your $dropdownOpts var might be incorrect. What is it when 
you debug?

-- 
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: It's possible to change Pagination output markup?

2012-02-23 Thread jeremyharris
Yep, look at the PaginatorHelper docs[1].

1: 
http://book.cakephp.org/2.0/en/core-libraries/helpers/paginator.html#PaginatorHelper

The book is your friend :)

-- 
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: Handling data returned by multi-select box

2012-02-23 Thread autnoc
I'm making a bit of headway here, but still can't figure out how to do
this.
Anyone have any ideas?

On Feb 9, 12:46 pm, autnoc  wrote:
> Hi! New to this group and to Cake.
>
> I have a form view for adding a record that has a multi-select (echo
> $this->Form->input('relatedShowList', array ('options' =>
> $dropdownOpts, 'type' => 'select', 'size' => '5', 'multiple' =>
> true));)
>
> Problem being after the form is submitted it's passed back to the
> controller with 'Array' (unquoted) for the value of the field.  I
> understand why Array appears and why the form is sending it in a way
> PHP interprets correctly as an array, but how I can pre-process that
> array to give me a list of CSV values that I can then slide into the
> proper place in the Insert query?
>
> I assume this would go in the $this->request->is('post') branch of the
> add function for the controller, but not sure how to get the query
> rewritten properly.
>
> Any help would be much appreciated.
>
> 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: How I can set "class" atributte for a Form?

2012-02-23 Thread reynie...@gmail.com
Thanks it works !!

Ing. Reynier Pérez Mira
http://reynierpm.site90.com/



On Thu, Feb 23, 2012 at 6:06 PM, Tilen Majerle wrote:

> $this->From->create('Information', array('class' => 'yourclassname'));
> --
> Lep pozdrav, Tilen Majerle
> http://majerle.eu
>
>
>
> 2012/2/23 reynie...@gmail.com 
>
>> Hi:
>> I was reading the doc for Form Helper finding how to add "class"
>> attribute to a  tag but can't find how, can any point me in the right
>> direction? I'm generating the form with this code: "echo
>> $this->Form->create('Information');"
>>
>> Ing. Reynier Pérez Mira
>> http://reynierpm.site90.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
>>
>
>  --
> 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: How I can set "class" atributte for a Form?

2012-02-23 Thread Tilen Majerle
$this->From->create('Information', array('class' => 'yourclassname'));
--
Lep pozdrav, Tilen Majerle
http://majerle.eu



2012/2/23 reynie...@gmail.com 

> Hi:
> I was reading the doc for Form Helper finding how to add "class" attribute
> to a  tag but can't find how, can any point me in the right
> direction? I'm generating the form with this code: "echo
> $this->Form->create('Information');"
>
> Ing. Reynier Pérez Mira
> http://reynierpm.site90.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
>

-- 
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 I can set "class" atributte for a Form?

2012-02-23 Thread reynie...@gmail.com
Hi:
I was reading the doc for Form Helper finding how to add "class" attribute
to a  tag but can't find how, can any point me in the right
direction? I'm generating the form with this code: "echo
$this->Form->create('Information');"

Ing. Reynier Pérez Mira
http://reynierpm.site90.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


Re: The classic "Fatal error: Call to a member function find() on a non-object" for newbie

2012-02-23 Thread jeremyharris
No problem. Sometimes it helps to have another person look at it :)

-- 
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: Chat with CakePHP...

2012-02-23 Thread majna
http://sandbox2.pseudocoder.com/demo/chat

-- 
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: The classic "Fatal error: Call to a member function find() on a non-object" for newbie

2012-02-23 Thread reynie...@gmail.com
Ohhh thanks I miss this part now it works.

Ing. Reynier Pérez Mira
http://reynierpm.site90.com/



On Thu, Feb 23, 2012 at 5:48 PM, jeremyharris  wrote:

> It's because the item Country does not exist on Information. Models are
> always singular, so where you have Countries defined in your Information
> belongsTo you should have Country instead.
>
> --
> 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: The classic "Fatal error: Call to a member function find() on a non-object" for newbie

2012-02-23 Thread jeremyharris
It's because the item Country does not exist on Information. Models are 
always singular, so where you have Countries defined in your Information 
belongsTo you should have Country instead.

-- 
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 while trying to bake model for specific table

2012-02-23 Thread jeremyharris
Bake the model Person or tell your People controller to use the People 
model.

-- 
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 while trying to bake model for specific table

2012-02-23 Thread reynie...@gmail.com
And? What's the solution for this problem? How I can fix this?

Ing. Reynier Pérez Mira
http://reynierpm.site90.com/



On Thu, Feb 23, 2012 at 5:30 PM, jeremyharris  wrote:

> The model it is probably looking for is Person, which in english is the
> singular of People.
>
> So PeopleController uses the Person model
>
> --
> 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: Error while trying to bake model for specific table

2012-02-23 Thread jeremyharris
The model it is probably looking for is Person, which in english is the 
singular of People.

So PeopleController uses the Person model

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


HABTM relationship

2012-02-23 Thread jholcomb
I am having a problem with an HABTM that has a forth table involved. Here's
the break down

Individuals
AccountsTrailers
AccountsTrailersIndividuals

AccountHolders

AccountsTrailersIndividuals has a field account_holder_id so that I can
associate an individual with an accountstrailer

the error I get is as follows:

Model "AccountsTrailersIndividual" is not associated with model
"AccountHolder"

but I have the associations set up properly in the models. They follow for
reference

AccountHolder Model
public $hasMany = array(
'AccountsTrailersIndividual' => array(
'className' => 'AccountsTrailersIndividual',
'foreignKey' => 'account_holder_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
)
);

AccountsTrailersIndividual Model
public $belongsTo = array(
'Individual' => array(
'className' => 'Individual',
'foreignKey' => 'individual_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
'AccountsTrailer' => array(
'className' => 'AccountsTrailer',
'foreignKey' => 'accounts_trailer_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
'AccountHolder' => array(
'className' => 'AccountHolder',
'foreignKey' => 'account_holder_id',
'conditions' => '',
'fields' => '',
'order' => ''
)
);

What am I missing? Thanks for your help.
Jamie

--
View this message in context: 
http://cakephp.1045679.n5.nabble.com/HABTM-relationship-tp5509633p5509633.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


AuthComponent and Session information not available in one of my controllers

2012-02-23 Thread Heather Walters
I have written my cake app to log in registered users and it works
great on view pages where there is a db model associated with a User.
However, on my main pages that aren't necessarily accessing some model
(the PagesController where pages are things like upcoming events,
contact us, about, etc), AuthComponent is not available, or at the
least, the array returns empty---so i cannot retrieve, say, the
username of the person logged in.


I tried creating a model called Page that belongsTo User but that
didn't fix my problem.

To explain a little further, my app shows lists of certain lodgings,
nightclubs, restaurants and things to do for a given city, all of
which is shown whether a user is logged in or not.  I don't understand
where I am going wrong and why.

Here is my AppController:

 array(
'loginRedirect' => array('controller' => 'users', 'action'
=> 'view'),
'logoutRedirect' => array('controller' => 'pages',
'action' => 'index')
)
);


function beforeFilter() {
$this->Auth->allow('login', 'logout','index', 'view',
'condos', 'houses', 'hotels_and_motels', 'print_all_coupons',
'print_coupon', 'search', 'golf', 'charters', 'events', 'nightlife',
'shopping', 'visitors_info', 'contact_us');

}
}
?>


here is where I access my username in my default page layout:

Hello,
'.AuthComponent::user('username').' | ';
?>

Since first posting this on another forum, I have moved all of my
PagesController pages to a folder and controller called Docs.  I have
tried setting $components and $helpers in the AppController for
Session.  I have found that if I echo pr($_SESSION) on my page layout,
on the Docs pages where I have a model call, I get an empty array.  On
my generic pages like the index and contact us, I get an "undefined
variable _SESSION" error.  I am fairly certain I am using a stable
release of cake (grabbed it in November, so it is 2.0.x).  Considering
that I am a noob, I am at a complete and utter loss as to what may be
happening.

-- 
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: is this possible ? Seeking advice from mysql gurus :)

2012-02-23 Thread Miloš Vučinić
Thanks a lot !

Also I just wanted to post one other way to do this because I googled
and just found out.

before your query just post smth like this..

$this->Custommer->hasMany['Payment']['order'] = 'id DESC';
$this->Custommer->hasMany['Payment']['limit'] = 2;

you can also place conditions there.

Thanx Jeremy !

All the best !
Milos



On Feb 23, 4:27 pm, jeremyharris  wrote:
> You can do this in a single find() call, using containable. (It will still
> create many mysql queries because that's just the way it needs to be done,
> however it will filter all the data for you).
>
> Something like:
>
> $this-> Customer ->find('all', array(
>   'conditions' => array(
>     'Customer.id' => 1
>   ),
>   'contain' => array(
>     'Invoice' => array(
>       'order' => 'Invoice.created DESC',
>       'limit' => 2
>     ),
>     'Credit' => array(
>       'conditions' => array('Credit.active' => true)
>     )
>   )
> ));
>
> This should fetch the customer info and include that customer's last 2
> invoices and all active credits.

-- 
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: Setting Class or ID property for Form Radio Input Label

2012-02-23 Thread mike karthauser

On 23 Feb 2012, at 18:49, Blues Clues  wrote:

> Hi:
> I am completely lost with this.
> 
> I am using Form helper in CakePHP and embedded a Radio input into it.
> The problem is that I need to set either class or id property for the
> label next to Radio to control it using css.
> 
> My code looks like this.
> $contract_type_options = array("Contract" => "Contract", "Remnant" =>
> "Remnant");
>echo $this->Form->input('Agreement.contracttype', array('type' =>
> 'radio', 'id' => 'idContractType', 'class' => 'classContractType',
> 'div' => false, 'options' => $contract_type_options));
> ?>
> 
> and the generated HTML looks like this:
> 
>  id="idContractType_" value="">
>  id="IdContractTypeContract" class="classContractType"
> value="Contract">
> Contract
>  id="IdContractTypeContract" class="classContractType" value="Remnant">
> Remnant
> 
> What I am looking for is to have a class and/or id assigned to those
> "Contract" like  for="IdContractTypeContract" class="classRadioLabel">Contract
> 
> What am I doing wrong here? Please help...I am going nuts with this.

Remove div=false and youll get a wrapper around your whole radios. Probably 
 or similar. Then you can select your labels by .radio 
label {}

Labels should all have the same treatment so you won't need to add a class to 
them specifically.

Hth


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


CakePHP Multiple field search with ALL fields being OPTIONAL

2012-02-23 Thread Web Tester
Hello all,

 i am implementing multiple search box with all parameter optional

I am doing with postConditions

here is my controller code

$conditions = $this->postConditions($this->data,
array(
'job_title' => 'LIKE',
'job_description'   => 'LIKE',
'industry'  => 'LIKE',
'job_type'  => 'LIKE',
'location'  => 'LIKE'
)
);


This is the sql it produces


SELECT  `Vacancy`.`id`,
`Vacancy`.`job_title`,
`Vacancy`.`job_type`,
`Vacancy`.`industry`,
`Vacancy`.`location`,
`Vacancy`.`salary`,
`Vacancy`.`job_description`,
`Vacancy`.`active`

FROM `vacancies` AS `Vacancy`

WHERE

`Vacancy`.`job_title` LIKE '%SearchKeyWords%'  AND
`Vacancy`.`industry` LIKE '%Information Technology%' AND
`Vacancy`.`job_type` LIKE '%Permanent%' AND `Vacancy`.`location`
LIKE 'London%'


Here when the search string is entered
the search string for example 'linux admin' should be checked with
table field called 'job_title' OR 'job_description'

Again the search string should be '%job_description%' (on both side
%searchString%,i.e,use of "%" on both side)
and for ALL others say job title it should be like 'job_title%' (on
one side searchString%,i.e,use of "%" on one side )

So the Final query should look like

SELECT  `Vacancy`.`id`,
`Vacancy`.`job_title`,
`Vacancy`.`job_type`,
`Vacancy`.`industry`,
`Vacancy`.`location`,
`Vacancy`.`salary`,
`Vacancy`.`job_description`,
`Vacancy`.`active`

FROM `vacancies` AS `Vacancy`

WHERE

`Vacancy`.`job_title`   LIKE   'SearchKeyWords%' OR //
One side has '%'
`Vacancy`.`job_description` LIKE   '%SearchKeyWords%'//
(ONLY THIS)two side has '%' AND
`Vacancy`.`industry`LIKE   'Information Technology%' AND   //
One side has '%'
`Vacancy`.`job_type`LIKE   'Permanent%'
AND//One side has '%'
`Vacancy`.`location`LIKE   'London
%'  //One side has '%'

I have tried all the ways to insert this line

`Vacancy`.`job_title` LIKE 'SearchKeyWords%' OR
`Vacancy`.`job_description` LIKE '%SearchKeyWords%'

but only the `Vacancy`.`job_title` comes up in query and not an OR
between job title and job description.

Please advice

-- 
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: Setting Class or ID property for Form Radio Input Label

2012-02-23 Thread mike karthauser
On 23 Feb 2012, at 18:49, Blues Clues  wrote:

> Hi:
> I am completely lost with this.
> 
> I am using Form helper in CakePHP and embedded a Radio input into it.
> The problem is that I need to set either class or id property for the
> label next to Radio to control it using css.
> 
> My code looks like this.
> $contract_type_options = array("Contract" => "Contract", "Remnant" =>
> "Remnant");
>echo $this->Form->input('Agreement.contracttype', array('type' =>
> 'radio', 'id' => 'idContractType', 'class' => 'classContractType',
> 'div' => false, 'options' => $contract_type_options));
> ?>
> 
> and the generated HTML looks like this:
> 
>  id="idContractType_" value="">
>  id="IdContractTypeContract" class="classContractType"
> value="Contract">
> Contract
>  id="IdContractTypeContract" class="classContractType" value="Remnant">
> Remnant
> 
> What I am looking for is to have a class and/or id assigned to those
> "Contract" like  for="IdContractTypeContract" class="classRadioLabel">Contract
> 
> What am I doing wrong here? Please help...I am going nuts with this.
> 
> -BC
> 
> -- 
> 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


Setting Class or ID property for Form Radio Input Label

2012-02-23 Thread Blues Clues
Hi:
I am completely lost with this.

I am using Form helper in CakePHP and embedded a Radio input into it.
The problem is that I need to set either class or id property for the
label next to Radio to control it using css.

My code looks like this.
 "Contract", "Remnant" =>
"Remnant");
echo $this->Form->input('Agreement.contracttype', array('type' =>
'radio', 'id' => 'idContractType', 'class' => 'classContractType',
'div' => false, 'options' => $contract_type_options));
?>

and the generated HTML looks like this:



Contract

Remnant

What I am looking for is to have a class and/or id assigned to those
"Contract" like Contract

What am I doing wrong here? Please help...I am going nuts with this.

-BC

-- 
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: Index.phpController could not be found

2012-02-23 Thread Stephen
You don't need any files in controllers for the application to work
correctly, the files needed out of the box are already stored in /cake/
(The core engine if you wish).

The homepage as I said (localhost/cakephp/) is linked to
/cake/libs/controller/pages_controller.php and inside this controller is a
function "display" which is displaying a page
/cake/libs/views/pages/home.ctp

You can overwrite these files by *creating a new* pages_controller.php in
/app/controllers/pages_controller.php and /views/pages/home.ctp etc.

That is how it works most of the time.

Definately an issue with your .htaccess / mod_rewrite, which web server are
you using, or do you use an app like EasyPHP ?

On 23 February 2012 16:32, amg55nj  wrote:

> Thanks for the reply.  They all have .htaccess files and made those
> changes to no success.
> I am reading through and trying what is suggested in this guide:
>
> http://book.cakephp.org/2.0/en/installation/advanced-installation.html
>
> but not having any success.  My app\Controller directory has no files and
> has a folder named Component with an "empty" file in it. Should there be a
> file in it since the error is saying it is looking for index.phpController?
>
> --
> 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
>



-- 
Kind Regards
 Stephen

 http://www.ninjacodermonkey.co.uk

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


Problems with cake bake

2012-02-23 Thread reynie...@gmail.com
Hi:
I'm trying to bake one of my DB tables and this is what I'm doing:
1) Create (M)odel for TblInformations table
2) Create (M)odel for TblInformationTypes table
3) Create (V)iew for  TblInformationTypes table but at this step I get
stucked and this error appear:

Error: Database table information for model Information was not found.
#0 /var/www/html/jobapp/lib/Cake/Model/Model.php(3265):
Model->setSource('information')
#1 /var/www/html/jobapp/lib/Cake/Model/Model.php(1223):
Model->getDataSource()
#2 /var/www/html/jobapp/lib/Cake/Model/Model.php(1309): Model->schema()
#3 /var/www/html/jobapp/lib/Cake/Model/Model.php(1295):
Model->hasField('title', false)
#4 /var/www/html/jobapp/lib/Cake/Model/Model.php(800):
Model->hasField(Array)
#5 /var/www/html/jobapp/lib/Cake/Console/Command/Task/ViewTask.php(459):
Model->__get('displayField')
#6 /var/www/html/jobapp/lib/Cake/Console/Command/Task/ViewTask.php(284):
ViewTask->_associations(Object(TblInformationType))
#7 /var/www/html/jobapp/lib/Cake/Console/Command/Task/ViewTask.php(223):
ViewTask->_loadController()
#8 /var/www/html/jobapp/lib/Cake/Console/Command/Task/ViewTask.php(90):
ViewTask->_interactive()
#9 /var/www/html/jobapp/lib/Cake/Console/Command/BakeShell.php(110):
ViewTask->execute()
#10 /var/www/html/jobapp/lib/Cake/Console/Command/BakeShell.php(131):
BakeShell->main()
#11 /var/www/html/jobapp/lib/Cake/Console/Shell.php(389): BakeShell->main()
#12 /var/www/html/jobapp/lib/Cake/Console/ShellDispatcher.php(177):
Shell->runCommand(NULL, Array)
#13 /var/www/html/jobapp/lib/Cake/Console/ShellDispatcher.php(69):
ShellDispatcher->dispatch()
#14 /var/www/html/jobapp/lib/Cake/Console/cake.php(24):
ShellDispatcher::run(Array)
#15 {main}

Any help? What I'm miss or doing wrong?
Cheers and thanks in advance
Ing. Reynier Pérez Mira
http://reynierpm.site90.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


Re: Error: Index.phpController could not be found

2012-02-23 Thread amg55nj
Installed 2.1 RC and still getting same error but now showing a stack trace 
if that will help.

Missing Controller

*Error: **Index.phpController* could not be found.

*Error: *Create the class *Index.phpController* below in file: 
app\Controller\Index.phpController.php

http://localhost/cakephp/index.php#> → 
Dispatcher->dispatch(CakeRequest, 
   CakeResponse) 
   - ROOT\index.php line 40  → 
   require(string) 

-- 
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: Index.phpController could not be found

2012-02-23 Thread amg55nj
Thanks for the reply.  They all have .htaccess files and made those changes 
to no success.
I am reading through and trying what is suggested in this guide:

http://book.cakephp.org/2.0/en/installation/advanced-installation.html 

but not having any success.  My app\Controller directory has no files and 
has a folder named Component with an "empty" file in it. Should there be a 
file in it since the error is saying it is looking for index.phpController?

-- 
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: Index.phpController could not be found

2012-02-23 Thread Stephen
Check your root, app and webroot directories to see if they actually
contain a .htaccess file.

Ensure your apache server configuration actually has the following (seeing
as it's localhost, allow everything?):

Options FollowSymLinks
AllowOverride All
Order deny,allow
Allow from all

Ensure the following line is not commented with a hash tag (#)

LoadModule rewrite_module libexec/apache2/mod_rewrite.so



On 23 February 2012 15:55, amg55nj  wrote:

> Opening that goes directly to 
> http://localhost/cakephp/**index.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
>



-- 
Kind Regards
 Stephen

 http://www.ninjacodermonkey.co.uk

-- 
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: Index.phpController could not be found

2012-02-23 Thread amg55nj
Opening that goes directly to http://localhost/cakephp/index.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: Error: Index.phpController could not be found

2012-02-23 Thread Tilen Majerle
http://localhost/cakephp /

open just this !
--
Lep pozdrav, Tilen Majerle
http://majerle.eu



2012/2/23 amg55nj 

> http://localhost/cakephp

-- 
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: Using $content_for_layout how :-(

2012-02-23 Thread Justin Edwards
https://github.com/search?q=cakephp+twitter+bootstrap&type=Everything&repo=&langOverride=&start_value=1

On Thu, Feb 23, 2012 at 9:37 AM, jeremyharris  wrote:
> To include CSS and JS, use the HtmlHelper[1]. This will include files from
> /webroot/css and /webroot/js
>
> $content_for_layout holds the content from the rendered view. All you need
> to do is echo it in the layout. There isn't anything more that you need to
> do with it.
>
> 1: http://book.cakephp.org/2.0/en/core-libraries/helpers/html.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+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: Error: Index.phpController could not be found

2012-02-23 Thread amg55nj
http://localhost/cakephp/index.php 

I enabled mod rewrites and uncommented the line for time after following a 
installation tutorial.
But still getting that error...

-- 
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: Using $content_for_layout how :-(

2012-02-23 Thread jeremyharris
To include CSS and JS, use the HtmlHelper[1]. This will include files from 
/webroot/css and /webroot/js

$content_for_layout holds the content from the rendered view. All you need 
to do is echo it in the layout. There isn't anything more that you need to 
do with it.

1: http://book.cakephp.org/2.0/en/core-libraries/helpers/html.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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Issue with Form Helper array('type' => 'file')

2012-02-23 Thread jeremyharris
What do you mean by corrupted? It should fail gracefully and stop the save 
process if there's an error.

-- 
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: Saving a field with every operation in controllers

2012-02-23 Thread jeremyharris
Depends what you mean by "make an action." Do you want to modify the 
timestamp each time they modify the database, or do you want to modify the 
timestamp each time they call an action, like /controller/action?

If it's the first, then use a behavior. There are a few "logging" behaviors 
out there that will do this for you (i.e., This user modified this model id 
on this date).

If it's the second, then a simple beforeFilter on AppController will 
suffice.

-- 
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: is this possible ? Seeking advice from mysql gurus :)

2012-02-23 Thread jeremyharris
You can do this in a single find() call, using containable. (It will still 
create many mysql queries because that's just the way it needs to be done, 
however it will filter all the data for you).

Something like:

$this-> Customer ->find('all', array(
  'conditions' => array(
'Customer.id' => 1
  ),
  'contain' => array(
'Invoice' => array(
  'order' => 'Invoice.created DESC',
  'limit' => 2
),
'Credit' => array(
  'conditions' => array('Credit.active' => true)
)
  )
));

This should fetch the customer info and include that customer's last 2 
invoices and all active credits.

-- 
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: Having strange problem with debug()

2012-02-23 Thread jeremyharris
That is weird, seeing as debug() uses print_r(). Try debug($results, false) 
to see what you get. If it shows info, the problem lies in the html entity 
encoding. Maybe you have html in your results that just cause it to look 
like nothing's there (view source to see what's really there).

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


Saving a field with every operation in controllers

2012-02-23 Thread socrates
hi every one i think it is a bad question, but i think that some one
can help me in this, i need to modify a time stamp and probably other
fiels in the user profile, every time a user make an action, i think
that the right place is to add a component to the AppController and
following the inheritance every operation on every controller would
update this field.
It is right, thanks for the attention!

-- 
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: Styles and JS not loaded

2012-02-23 Thread reynie...@gmail.com
Ok sorry for that my bad I'm using ->script when should be ->css miss this
mail
:-(
Ing. Reynier Pérez Mira
http://reynierpm.site90.com/



On Thu, Feb 23, 2012 at 9:19 AM, reynie...@gmail.com wrote:

> Hi:
> I'm trying to use Twitter Bootstrap for the look & feel of my application
> but I must doing something wrong because does not work :-(. I've created a
> file called default.ctp under View/Layouts folder and in this file I use
> this code for styles:
>
> 
>
> Html->script('bootstrap.min.css'); ?>
> 
>
> But it's not working because no 

Re: Why data isn't showed?

2012-02-23 Thread reynie...@gmail.com
Fine, it works now and I understand well this part, cheers and thanks Tilen

Ing. Reynier Pérez Mira
http://reynierpm.site90.com/



On Thu, Feb 23, 2012 at 8:55 AM, Tilen Majerle wrote:

> read manual again !
>
> models names are Country (singularized and camelized), and controllers are
> CountriesController (pluralized))
> --
> Lep pozdrav, Tilen Majerle
> http://majerle.eu
>
>
>
> 2012/2/23 reynie...@gmail.com 
>
>> OK, I made some changes to my DB structure and also to my code but still
>> getting errors, see below what I'm doing now.
>> 1) Change the table from countries to country and  also rename the
>> composite PK from country_id to id
>> 2) Change code in the Model, now looks like this:
>>
>> > class Country extends AppModel {
>> public $name = 'Country';
>> }
>>
>> 3) Change code in the Controller:
>> class CountryController extends AppController {
>> public $name = 'Country';
>>  public $helpers = array("Html", "Form");
>> public $components = array("Session");
>>
>> public function edit($id = null) {
>> $this->Country->id = $id;
>>  if ($this->request->is('get')) {
>> $this->request->data = $this->Country->read();
>>  } else {
>> if ($this->Countries->save($this->request->data)) {
>>  $this->Session->setFlash(__('The country has been updated.'));
>> $this->redirect(array('action' => 'index'));
>>  } else {
>> $this->Session->setFlash(__('Unable to update the country.'));
>>  }
>> }
>> }
>>
>> But I get this error:
>> Missing Database Table
>> Error: Database table countries for model Country was not found.
>> Why?
>> Ing. Reynier Pérez Mira
>> http://reynierpm.site90.com/
>>
>>
>>
>> On Thu, Feb 23, 2012 at 8:29 AM, reynie...@gmail.com > > wrote:
>>
>>> So because CakePHP doesn't support compsite PK then the solution need to
>>> be change the field country_id for id and also in all the tables. Reading
>>> the conventions for Models I get one doubt and goes to oneToMany relations.
>>> If I have one relation oneToMany between tables candidate and education and
>>> I add the FK candidate_id in education table then CakePHP knows the
>>> relation by default? This is correct? Please can you take a look at my DB
>>> design and tell me if something is wrong there:
>>> http://www.dropmocks.com/mBgrQq ?
>>>
>>> Ing. Reynier Pérez Mira
>>> http://reynierpm.site90.com/
>>>
>>>
>>>
>>> On Thu, Feb 23, 2012 at 7:40 AM, Tilen Majerle 
>>> wrote:
>>>
 http://book.cakephp.org/2.0/en/getting-started/cakephp-conventions.html


 look here, cakephp conventions
 --
 Lep pozdrav, Tilen Majerle
 http://majerle.eu



 2012/2/23 reynie...@gmail.com 

> Hi Tilen, I not understand your point here. As you said I have
> country_id as PK and my table is Countries not Country so my model code is
> this one (Countries.php):
>
> class Countries extends AppModel {
>  public $name = 'Countries';
> }
>
> then if I use $this->Country->id = $id doesn't work and if I
> use $this->Countries->country_id = $id doesn't work too. Which should be
> the solution? Change my table structure or what?
>
> Ing. Reynier Pérez Mira
> http://reynierpm.site90.com/
>
>
>
> On Thu, Feb 23, 2012 at 5:02 AM, Tilen Majerle <
> tilen.maje...@gmail.com> wrote:
>
>> you have "country_id" as your primary key in table ?
>>
>> and "Countries" for modelname ?
>> it should be "Country" right ? :)
>>
>> $this->Countries->country_id = $id; //this is wrong
>> here should be ALWAYS "id", so $this->Countries->id = $id;
>>
>> but u should use camelized and singularized name, so
>> $this->Country->id = $id and it will work
>>
>>
>>
>> VIEW:
>> Form::create(); here you should have the same model name as you pass
>> data, "Country" and not CountryFrm
>> --
>> Lep pozdrav, Tilen Majerle
>> http://majerle.eu
>>
>>
>>
>> 2012/2/23 reynie...@gmail.com 
>>
>>> Hi every:
>>> Take a look at this function:
>>>
>>> public function edit($id = null) {
>>> $this->Countries->country_id = $id;
>>>  if ($this->request->is('get')) {
>>> $this->request->data = $this->Countries->read();
>>>  } else {
>>> if ($this->Countries->save($this->request->data)) {
>>>  $this->Session->setFlash(__('The country has been updated.'));
>>> $this->redirect(array('action' => 'index'));
>>>  } else {
>>> $this->Session->setFlash(__('Unable to update the country.'));
>>>  }
>>> }
>>> }
>>>
>>> Aparently all seems to be fine but surprise when I call edit method
>>> and pass a ID as parameter the data isn't showed in the template, why? 
>>> Any
>>> help? This is the edit.ctp content:
>>>
>>> Edit Country
>>> >> echo $this->Form->create('CountryFrm', array('action' =>
>>> 'edit'));
>>> echo $this->Form->input('country_name');
>>> echo $this->Form->input('iso_code_2')

Styles and JS not loaded

2012-02-23 Thread reynie...@gmail.com
Hi:
I'm trying to use Twitter Bootstrap for the look & feel of my application
but I must doing something wrong because does not work :-(. I've created a
file called default.ctp under View/Layouts folder and in this file I use
this code for styles:


   
Html->script('bootstrap.min.css'); ?>


But it's not working because no 

Re: App::uses Question

2012-02-23 Thread heohni
??
Now I am totally lost.

On 23 Feb., 14:37, Tilen Majerle  wrote:
> yes, because components can be used ONLY in controllers, if you need this
> somewhere else, use Library :)
> --
> Lep pozdrav, Tilen Majerlehttp://majerle.eu
>
> 2012/2/23 heohni 
>
>
>
>
>
>
>
> > Dear Tilen,
>
> > How can I make it then useable?
>
> > $Functions = new FunctionsComponent(); is not working...
>
> > On 23 Feb., 14:28, Tilen Majerle  wrote:
> > > first, App::uses has following: App::uses('NameOfAClass', 'Path'); so in
> > ur
> > > case it should be
> > > App::uses('FunctionsComponent', 'Controller/Component');, if you're using
> > > this component in plugin, use
> > > App::uses('FunctionsComponent', 'PluginName.Controller/Component');
>
> > > where do u want to use this component ? probably in controller, add
> > > component name to $components list in controller propertieshttp://
> > book.cakephp.org/2.0/en/controllers.html#components-helpers-an...
> > > --
> > > Lep pozdrav, Tilen Majerlehttp://majerle.eu
>
> > > 2012/2/23 heohni 
>
> > > > HI,
>
> > > > I want to use a component function within my model, now in V2.1. how
> > > > can I do that?
>
> > > > Is it right that I need t use this:
>
> > > > App::uses('Functions', 'Component');
>
> > > > But what else do I need to use $this->Functions->needfullthing()?
>
> > > > --
> > > > 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: App::uses Question

2012-02-23 Thread heohni
Dear Tilen,

How can I make it then useable?

$Functions = new FunctionsComponent(); is not working...

On 23 Feb., 14:28, Tilen Majerle  wrote:
> first, App::uses has following: App::uses('NameOfAClass', 'Path'); so in ur
> case it should be
> App::uses('FunctionsComponent', 'Controller/Component');, if you're using
> this component in plugin, use
> App::uses('FunctionsComponent', 'PluginName.Controller/Component');
>
> where do u want to use this component ? probably in controller, add
> component name to $components list in controller 
> propertieshttp://book.cakephp.org/2.0/en/controllers.html#components-helpers-an...
> --
> Lep pozdrav, Tilen Majerlehttp://majerle.eu
>
> 2012/2/23 heohni 
>
>
>
>
>
>
>
> > HI,
>
> > I want to use a component function within my model, now in V2.1. how
> > can I do that?
>
> > Is it right that I need t use this:
>
> > App::uses('Functions', 'Component');
>
> > But what else do I need to use $this->Functions->needfullthing()?
>
> > --
> > 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: App::uses Question

2012-02-23 Thread Tilen Majerle
first, App::uses has following: App::uses('NameOfAClass', 'Path'); so in ur
case it should be
App::uses('FunctionsComponent', 'Controller/Component');, if you're using
this component in plugin, use
App::uses('FunctionsComponent', 'PluginName.Controller/Component');


where do u want to use this component ? probably in controller, add
component name to $components list in controller properties
http://book.cakephp.org/2.0/en/controllers.html#components-helpers-and-uses
--
Lep pozdrav, Tilen Majerle
http://majerle.eu



2012/2/23 heohni 

> HI,
>
> I want to use a component function within my model, now in V2.1. how
> can I do that?
>
> Is it right that I need t use this:
>
> App::uses('Functions', 'Component');
>
> But what else do I need to use $this->Functions->needfullthing()?
>
> --
> 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: Why data isn't showed?

2012-02-23 Thread Tilen Majerle
read manual again !

models names are Country (singularized and camelized), and controllers are
CountriesController (pluralized))
--
Lep pozdrav, Tilen Majerle
http://majerle.eu



2012/2/23 reynie...@gmail.com 

> OK, I made some changes to my DB structure and also to my code but still
> getting errors, see below what I'm doing now.
> 1) Change the table from countries to country and  also rename the
> composite PK from country_id to id
> 2) Change code in the Model, now looks like this:
>
>  class Country extends AppModel {
> public $name = 'Country';
> }
>
> 3) Change code in the Controller:
> class CountryController extends AppController {
> public $name = 'Country';
>  public $helpers = array("Html", "Form");
> public $components = array("Session");
>
> public function edit($id = null) {
> $this->Country->id = $id;
>  if ($this->request->is('get')) {
> $this->request->data = $this->Country->read();
>  } else {
> if ($this->Countries->save($this->request->data)) {
>  $this->Session->setFlash(__('The country has been updated.'));
> $this->redirect(array('action' => 'index'));
>  } else {
> $this->Session->setFlash(__('Unable to update the country.'));
>  }
> }
> }
>
> But I get this error:
> Missing Database Table
> Error: Database table countries for model Country was not found.
> Why?
> Ing. Reynier Pérez Mira
> http://reynierpm.site90.com/
>
>
>
> On Thu, Feb 23, 2012 at 8:29 AM, reynie...@gmail.com 
> wrote:
>
>> So because CakePHP doesn't support compsite PK then the solution need to
>> be change the field country_id for id and also in all the tables. Reading
>> the conventions for Models I get one doubt and goes to oneToMany relations.
>> If I have one relation oneToMany between tables candidate and education and
>> I add the FK candidate_id in education table then CakePHP knows the
>> relation by default? This is correct? Please can you take a look at my DB
>> design and tell me if something is wrong there:
>> http://www.dropmocks.com/mBgrQq ?
>>
>> Ing. Reynier Pérez Mira
>> http://reynierpm.site90.com/
>>
>>
>>
>> On Thu, Feb 23, 2012 at 7:40 AM, Tilen Majerle 
>> wrote:
>>
>>> http://book.cakephp.org/2.0/en/getting-started/cakephp-conventions.html
>>>
>>> look here, cakephp conventions
>>> --
>>> Lep pozdrav, Tilen Majerle
>>> http://majerle.eu
>>>
>>>
>>>
>>> 2012/2/23 reynie...@gmail.com 
>>>
 Hi Tilen, I not understand your point here. As you said I have
 country_id as PK and my table is Countries not Country so my model code is
 this one (Countries.php):

 class Countries extends AppModel {
  public $name = 'Countries';
 }

 then if I use $this->Country->id = $id doesn't work and if I
 use $this->Countries->country_id = $id doesn't work too. Which should be
 the solution? Change my table structure or what?

 Ing. Reynier Pérez Mira
 http://reynierpm.site90.com/



 On Thu, Feb 23, 2012 at 5:02 AM, Tilen Majerle >>> > wrote:

> you have "country_id" as your primary key in table ?
>
> and "Countries" for modelname ?
> it should be "Country" right ? :)
>
> $this->Countries->country_id = $id; //this is wrong
> here should be ALWAYS "id", so $this->Countries->id = $id;
>
> but u should use camelized and singularized name, so
> $this->Country->id = $id and it will work
>
>
>
> VIEW:
> Form::create(); here you should have the same model name as you pass
> data, "Country" and not CountryFrm
> --
> Lep pozdrav, Tilen Majerle
> http://majerle.eu
>
>
>
> 2012/2/23 reynie...@gmail.com 
>
>> Hi every:
>> Take a look at this function:
>>
>> public function edit($id = null) {
>> $this->Countries->country_id = $id;
>>  if ($this->request->is('get')) {
>> $this->request->data = $this->Countries->read();
>>  } else {
>> if ($this->Countries->save($this->request->data)) {
>>  $this->Session->setFlash(__('The country has been updated.'));
>> $this->redirect(array('action' => 'index'));
>>  } else {
>> $this->Session->setFlash(__('Unable to update the country.'));
>>  }
>> }
>> }
>>
>> Aparently all seems to be fine but surprise when I call edit method
>> and pass a ID as parameter the data isn't showed in the template, why? 
>> Any
>> help? This is the edit.ctp content:
>>
>> Edit Country
>> > echo $this->Form->create('CountryFrm', array('action' => 'edit'));
>> echo $this->Form->input('country_name');
>> echo $this->Form->input('iso_code_2');
>> echo $this->Form->input('iso_code_3');
>> echo $this->Form->input('country_id', array('type' => 'hidden'));
>> echo $this->Form->end('Save!!!');
>>
>>
>> Ing. Reynier Pérez Mira
>> http://reynierpm.site90.com/
>>
>>  --
>> Our newest site for the community: CakePHP Video Tutorials
>> http://tv.cakephp.org
>> Check out the

Chat with CakePHP...

2012-02-23 Thread Maicon Pinto
Hello,
I'm working with cakephp, and I want to develop a chat. Does anyone here 
have a simple tutorial how to tip? 

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


is this possible ? Seeking advice from mysql gurus :)

2012-02-23 Thread Miloš Vučinić
Hi :)

so far I haven't had any really complex querys so there is one now and
I seek for the advice on how to handle it. Now I now how to fix this
redneck style (several queries etc, or one big and then filter in
controller), however I am looking for a little more elegant solution.

I have a model which has about 7 other sub models (has many) . Main is
a customer and has many appointments, invoices , payments etc...
So I need to fetch a customer and 2 last inserted of each of its has
many models. Example is : One specific customer (found by ID) and 2 of
his last invoices, 2 of his last payments and so on..
And to make it a bit more complicated, for just one of these sub
models (named Credits) I need to fetch all of the active ones...

My way so far is to fetch all of the data with classic find and then
in one FOR loop filter out data I do not need... Is there a way a
single query could do this.. ??

Thank you in advance you mighty mysql gurus :)

All the best,
Milos

-- 
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: Why data isn't showed?

2012-02-23 Thread reynie...@gmail.com
OK, I made some changes to my DB structure and also to my code but still
getting errors, see below what I'm doing now.
1) Change the table from countries to country and  also rename the
composite PK from country_id to id
2) Change code in the Model, now looks like this:

Country->id = $id;
 if ($this->request->is('get')) {
$this->request->data = $this->Country->read();
 } else {
if ($this->Countries->save($this->request->data)) {
 $this->Session->setFlash(__('The country has been updated.'));
$this->redirect(array('action' => 'index'));
 } else {
$this->Session->setFlash(__('Unable to update the country.'));
 }
}
}

But I get this error:
Missing Database Table
Error: Database table countries for model Country was not found.
Why?
Ing. Reynier Pérez Mira
http://reynierpm.site90.com/



On Thu, Feb 23, 2012 at 8:29 AM, reynie...@gmail.com wrote:

> So because CakePHP doesn't support compsite PK then the solution need to
> be change the field country_id for id and also in all the tables. Reading
> the conventions for Models I get one doubt and goes to oneToMany relations.
> If I have one relation oneToMany between tables candidate and education and
> I add the FK candidate_id in education table then CakePHP knows the
> relation by default? This is correct? Please can you take a look at my DB
> design and tell me if something is wrong there:
> http://www.dropmocks.com/mBgrQq ?
>
> Ing. Reynier Pérez Mira
> http://reynierpm.site90.com/
>
>
>
> On Thu, Feb 23, 2012 at 7:40 AM, Tilen Majerle wrote:
>
>> http://book.cakephp.org/2.0/en/getting-started/cakephp-conventions.html
>>
>> look here, cakephp conventions
>> --
>> Lep pozdrav, Tilen Majerle
>> http://majerle.eu
>>
>>
>>
>> 2012/2/23 reynie...@gmail.com 
>>
>>> Hi Tilen, I not understand your point here. As you said I have
>>> country_id as PK and my table is Countries not Country so my model code is
>>> this one (Countries.php):
>>>
>>> class Countries extends AppModel {
>>>  public $name = 'Countries';
>>> }
>>>
>>> then if I use $this->Country->id = $id doesn't work and if I
>>> use $this->Countries->country_id = $id doesn't work too. Which should be
>>> the solution? Change my table structure or what?
>>>
>>> Ing. Reynier Pérez Mira
>>> http://reynierpm.site90.com/
>>>
>>>
>>>
>>> On Thu, Feb 23, 2012 at 5:02 AM, Tilen Majerle 
>>> wrote:
>>>
 you have "country_id" as your primary key in table ?

 and "Countries" for modelname ?
 it should be "Country" right ? :)

 $this->Countries->country_id = $id; //this is wrong
 here should be ALWAYS "id", so $this->Countries->id = $id;

 but u should use camelized and singularized name, so $this->Country->id
 = $id and it will work



 VIEW:
 Form::create(); here you should have the same model name as you pass
 data, "Country" and not CountryFrm
 --
 Lep pozdrav, Tilen Majerle
 http://majerle.eu



 2012/2/23 reynie...@gmail.com 

> Hi every:
> Take a look at this function:
>
> public function edit($id = null) {
> $this->Countries->country_id = $id;
>  if ($this->request->is('get')) {
> $this->request->data = $this->Countries->read();
>  } else {
> if ($this->Countries->save($this->request->data)) {
>  $this->Session->setFlash(__('The country has been updated.'));
> $this->redirect(array('action' => 'index'));
>  } else {
> $this->Session->setFlash(__('Unable to update the country.'));
>  }
> }
> }
>
> Aparently all seems to be fine but surprise when I call edit method
> and pass a ID as parameter the data isn't showed in the template, why? Any
> help? This is the edit.ctp content:
>
> Edit Country
>  echo $this->Form->create('CountryFrm', array('action' => 'edit'));
> echo $this->Form->input('country_name');
> echo $this->Form->input('iso_code_2');
> echo $this->Form->input('iso_code_3');
> echo $this->Form->input('country_id', array('type' => 'hidden'));
> echo $this->Form->end('Save!!!');
>
>
> Ing. Reynier Pérez Mira
> http://reynierpm.site90.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
>

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

App::uses Question

2012-02-23 Thread heohni
HI,

I want to use a component function within my model, now in V2.1. how
can I do that?

Is it right that I need t use this:

App::uses('Functions', 'Component');

But what else do I need to use $this->Functions->needfullthing()?

-- 
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: Why data isn't showed?

2012-02-23 Thread reynie...@gmail.com
So because CakePHP doesn't support compsite PK then the solution need to be
change the field country_id for id and also in all the tables. Reading the
conventions for Models I get one doubt and goes to oneToMany relations. If
I have one relation oneToMany between tables candidate and education and I
add the FK candidate_id in education table then CakePHP knows the relation
by default? This is correct? Please can you take a look at my DB design and
tell me if something is wrong there:  http://www.dropmocks.com/mBgrQq ?

Ing. Reynier Pérez Mira
http://reynierpm.site90.com/



On Thu, Feb 23, 2012 at 7:40 AM, Tilen Majerle wrote:

> http://book.cakephp.org/2.0/en/getting-started/cakephp-conventions.html
>
> look here, cakephp conventions
> --
> Lep pozdrav, Tilen Majerle
> http://majerle.eu
>
>
>
> 2012/2/23 reynie...@gmail.com 
>
>> Hi Tilen, I not understand your point here. As you said I have country_id
>> as PK and my table is Countries not Country so my model code is this one
>> (Countries.php):
>>
>> class Countries extends AppModel {
>>  public $name = 'Countries';
>> }
>>
>> then if I use $this->Country->id = $id doesn't work and if I
>> use $this->Countries->country_id = $id doesn't work too. Which should be
>> the solution? Change my table structure or what?
>>
>> Ing. Reynier Pérez Mira
>> http://reynierpm.site90.com/
>>
>>
>>
>> On Thu, Feb 23, 2012 at 5:02 AM, Tilen Majerle 
>> wrote:
>>
>>> you have "country_id" as your primary key in table ?
>>>
>>> and "Countries" for modelname ?
>>> it should be "Country" right ? :)
>>>
>>> $this->Countries->country_id = $id; //this is wrong
>>> here should be ALWAYS "id", so $this->Countries->id = $id;
>>>
>>> but u should use camelized and singularized name, so $this->Country->id
>>> = $id and it will work
>>>
>>>
>>>
>>> VIEW:
>>> Form::create(); here you should have the same model name as you pass
>>> data, "Country" and not CountryFrm
>>> --
>>> Lep pozdrav, Tilen Majerle
>>> http://majerle.eu
>>>
>>>
>>>
>>> 2012/2/23 reynie...@gmail.com 
>>>
 Hi every:
 Take a look at this function:

 public function edit($id = null) {
 $this->Countries->country_id = $id;
  if ($this->request->is('get')) {
 $this->request->data = $this->Countries->read();
  } else {
 if ($this->Countries->save($this->request->data)) {
  $this->Session->setFlash(__('The country has been updated.'));
 $this->redirect(array('action' => 'index'));
  } else {
 $this->Session->setFlash(__('Unable to update the country.'));
  }
 }
 }

 Aparently all seems to be fine but surprise when I call edit method and
 pass a ID as parameter the data isn't showed in the template, why? Any
 help? This is the edit.ctp content:

 Edit Country
 >>> echo $this->Form->create('CountryFrm', array('action' => 'edit'));
 echo $this->Form->input('country_name');
 echo $this->Form->input('iso_code_2');
 echo $this->Form->input('iso_code_3');
 echo $this->Form->input('country_id', array('type' => 'hidden'));
 echo $this->Form->end('Save!!!');


 Ing. Reynier Pérez Mira
 http://reynierpm.site90.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

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

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

Re: Why data isn't showed?

2012-02-23 Thread Tilen Majerle
http://book.cakephp.org/2.0/en/getting-started/cakephp-conventions.html

look here, cakephp conventions
--
Lep pozdrav, Tilen Majerle
http://majerle.eu



2012/2/23 reynie...@gmail.com 

> Hi Tilen, I not understand your point here. As you said I have country_id
> as PK and my table is Countries not Country so my model code is this one
> (Countries.php):
>
> class Countries extends AppModel {
>  public $name = 'Countries';
> }
>
> then if I use $this->Country->id = $id doesn't work and if I
> use $this->Countries->country_id = $id doesn't work too. Which should be
> the solution? Change my table structure or what?
>
> Ing. Reynier Pérez Mira
> http://reynierpm.site90.com/
>
>
>
> On Thu, Feb 23, 2012 at 5:02 AM, Tilen Majerle wrote:
>
>> you have "country_id" as your primary key in table ?
>>
>> and "Countries" for modelname ?
>> it should be "Country" right ? :)
>>
>> $this->Countries->country_id = $id; //this is wrong
>> here should be ALWAYS "id", so $this->Countries->id = $id;
>>
>> but u should use camelized and singularized name, so $this->Country->id =
>> $id and it will work
>>
>>
>>
>> VIEW:
>> Form::create(); here you should have the same model name as you pass
>> data, "Country" and not CountryFrm
>> --
>> Lep pozdrav, Tilen Majerle
>> http://majerle.eu
>>
>>
>>
>> 2012/2/23 reynie...@gmail.com 
>>
>>> Hi every:
>>> Take a look at this function:
>>>
>>> public function edit($id = null) {
>>> $this->Countries->country_id = $id;
>>>  if ($this->request->is('get')) {
>>> $this->request->data = $this->Countries->read();
>>>  } else {
>>> if ($this->Countries->save($this->request->data)) {
>>>  $this->Session->setFlash(__('The country has been updated.'));
>>> $this->redirect(array('action' => 'index'));
>>>  } else {
>>> $this->Session->setFlash(__('Unable to update the country.'));
>>>  }
>>> }
>>> }
>>>
>>> Aparently all seems to be fine but surprise when I call edit method and
>>> pass a ID as parameter the data isn't showed in the template, why? Any
>>> help? This is the edit.ctp content:
>>>
>>> Edit Country
>>> >> echo $this->Form->create('CountryFrm', array('action' => 'edit'));
>>> echo $this->Form->input('country_name');
>>> echo $this->Form->input('iso_code_2');
>>> echo $this->Form->input('iso_code_3');
>>> echo $this->Form->input('country_id', array('type' => 'hidden'));
>>> echo $this->Form->end('Save!!!');
>>>
>>>
>>> Ing. Reynier Pérez Mira
>>> http://reynierpm.site90.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
>>>
>>
>>  --
>> 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: Why data isn't showed?

2012-02-23 Thread reynie...@gmail.com
Hi Tilen, I not understand your point here. As you said I have country_id
as PK and my table is Countries not Country so my model code is this one
(Countries.php):

class Countries extends AppModel {
 public $name = 'Countries';
}

then if I use $this->Country->id = $id doesn't work and if I
use $this->Countries->country_id = $id doesn't work too. Which should be
the solution? Change my table structure or what?

Ing. Reynier Pérez Mira
http://reynierpm.site90.com/



On Thu, Feb 23, 2012 at 5:02 AM, Tilen Majerle wrote:

> you have "country_id" as your primary key in table ?
>
> and "Countries" for modelname ?
> it should be "Country" right ? :)
>
> $this->Countries->country_id = $id; //this is wrong
> here should be ALWAYS "id", so $this->Countries->id = $id;
>
> but u should use camelized and singularized name, so $this->Country->id =
> $id and it will work
>
>
>
> VIEW:
> Form::create(); here you should have the same model name as you pass data,
> "Country" and not CountryFrm
> --
> Lep pozdrav, Tilen Majerle
> http://majerle.eu
>
>
>
> 2012/2/23 reynie...@gmail.com 
>
>> Hi every:
>> Take a look at this function:
>>
>> public function edit($id = null) {
>> $this->Countries->country_id = $id;
>>  if ($this->request->is('get')) {
>> $this->request->data = $this->Countries->read();
>>  } else {
>> if ($this->Countries->save($this->request->data)) {
>>  $this->Session->setFlash(__('The country has been updated.'));
>> $this->redirect(array('action' => 'index'));
>>  } else {
>> $this->Session->setFlash(__('Unable to update the country.'));
>>  }
>> }
>> }
>>
>> Aparently all seems to be fine but surprise when I call edit method and
>> pass a ID as parameter the data isn't showed in the template, why? Any
>> help? This is the edit.ctp content:
>>
>> Edit Country
>> > echo $this->Form->create('CountryFrm', array('action' => 'edit'));
>> echo $this->Form->input('country_name');
>> echo $this->Form->input('iso_code_2');
>> echo $this->Form->input('iso_code_3');
>> echo $this->Form->input('country_id', array('type' => 'hidden'));
>> echo $this->Form->end('Save!!!');
>>
>>
>> Ing. Reynier Pérez Mira
>> http://reynierpm.site90.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
>>
>
>  --
> 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


Issue with Form Helper array('type' => 'file')

2012-02-23 Thread Kro
I am saving a Rate record and an associated image using the Media
plugin (https://github.com/davidpersson/media). Everything works fine
when an image is added, when an image isn't added the Rate record gets
corrupted.

The array is as follows:

Array ( [Rate] => Array ( [enabled] => 0 [is_corporate] => 0
[special_offer] => 0 [list_no] => 0 [id_ref] => 43564566 [title] =>
rate7 [price_quote_as] => 0 [adult_supplement] => 0 [child_supplement]
=> 0 [supplement] => 0 [short_description] => rate7 [description] =>

rate7
[available] => Array ( [0] => 2 ) [minimum_stay] => 0 [maximum_stay]
=> 0 [valid_from] => 2012-02-24 [valid_to] => 2012-02-25 [file] =>
Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 ) )
[Room] => Array ( [Room] => Array ( [0] => 16 ) ) )

Note the 'file' array with the error 4.

Any help would be greatly appreciated.

-- 
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: Media Plugin of David Persson is for cake 1.3 and for cake 2.0?

2012-02-23 Thread Rodrigo Rodrigues Moyle
Have you tried this plugin:

https://github.com/josegonzalez/upload/tree/2.0

-- 
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: simple auth in 2.0

2012-02-23 Thread pablosky
Thank you very much. I had read the documentation and I do not really
understand. But I had not read the example.

It all works correctly.

On 23 feb, 09:53, heohni  wrote:
> http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-examp...
> Simple Authentication and Authorization Application Tutorial
>
> On 22 Feb., 21:23, pablosky  wrote:
>
>
>
>
>
>
>
> > Hello,
>
> > I used CakePHP 1.3 and now I come to CakePHP 2.0.
>
> > Do not know how to do a simple authentication system.
>
> > I have this in AppController:
>
> > public $components = array('Cookie', 'RequestHandler', 'Session',
> > 'Auth');
>
> > public function beforeFilter() {
>
> >     $this->Auth->loginRedirect = array('controller' => 'index',
> > 'action' => 'action_index');
>
> >     if (isset($this->request->params['prefix']) && 
> > $this->request->params['prefix'] == 'admin') {
>
> >         $this->layout = 'admin';
> >         $this->set('Auth', $this->Auth->user());
> >     } else {
> >         $this->Auth->allow();
> >     }
>
> > }
>
> > If someone knows that I do wrong?
>
> > 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: Why data isn't showed?

2012-02-23 Thread Tilen Majerle
you have "country_id" as your primary key in table ?

and "Countries" for modelname ?
it should be "Country" right ? :)

$this->Countries->country_id = $id; //this is wrong
here should be ALWAYS "id", so $this->Countries->id = $id;

but u should use camelized and singularized name, so $this->Country->id =
$id and it will work



VIEW:
Form::create(); here you should have the same model name as you pass data,
"Country" and not CountryFrm
--
Lep pozdrav, Tilen Majerle
http://majerle.eu



2012/2/23 reynie...@gmail.com 

> Hi every:
> Take a look at this function:
>
> public function edit($id = null) {
> $this->Countries->country_id = $id;
>  if ($this->request->is('get')) {
> $this->request->data = $this->Countries->read();
>  } else {
> if ($this->Countries->save($this->request->data)) {
>  $this->Session->setFlash(__('The country has been updated.'));
> $this->redirect(array('action' => 'index'));
>  } else {
> $this->Session->setFlash(__('Unable to update the country.'));
>  }
> }
> }
>
> Aparently all seems to be fine but surprise when I call edit method and
> pass a ID as parameter the data isn't showed in the template, why? Any
> help? This is the edit.ctp content:
>
> Edit Country
>  echo $this->Form->create('CountryFrm', array('action' => 'edit'));
> echo $this->Form->input('country_name');
> echo $this->Form->input('iso_code_2');
> echo $this->Form->input('iso_code_3');
> echo $this->Form->input('country_id', array('type' => 'hidden'));
> echo $this->Form->end('Save!!!');
>
>
> Ing. Reynier Pérez Mira
> http://reynierpm.site90.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
>

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


Using $content_for_layout how :-(

2012-02-23 Thread reynie...@gmail.com
Hi every, I'm newbie using CakePHP and have several doubts and here I come
with two of them. I'm trying to use Twitter Bootstrap to build my
application Layout, now:

   - I've created the file View/Layouts/default.ctp and inside in the code
   I need to use $content_for_layout ($this->fetch it's only available from
   release 2.1.x and I'm working with 2.0.5) to fetch Bootstrap files, how?
   - Twitter Bootstrap comes with several files which I put inside
   app/webroot and of course in the right folder, how I can use this files in
   default.ctp?

Regards, and thanks in advance
Ing. Reynier Pérez Mira
http://reynierpm.site90.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


Re: problems with belongsTo and hasMany...

2012-02-23 Thread Stephen
try the following:

$hasMany = array('Profile');

$belongsTo = array('User');

Cheers

On 22 February 2012 19:02, Miguel Ángel Moreno Armenteros <
miguel.s.addr...@gmail.com> wrote:

> Hello, i know this subject comes over and over but I couldnt find the
> solution..
> Im a beginner and iam testing out some scaffolding and so on.
>
> I have Profiles of user and Users, who belong to a certain profile.
> for that i have two tables
>
> users
>id int not null auto_increment primary key
>username
>name
>profile_id
> .
>
>
> profile
>  id
>  profile
>
>
> in the models i have this
> profile.php
>
>  class Profile extends AppModel{
>var $name = 'Profile';
>var $hasMany = 'User';
> }
> ?>
>
> user.php
>
>  class User extends AppModel{
>var $name = 'User';
>var $belongsTo = 'Profile';
> }
> ?>
>
>
> and the controllers
>
> profiles_controller.php
>  class ProfilesController extends AppController{
>var $name = "Profiles";
>var $scaffold;
> }
>
> ?>
>
> users_controller.php
>  class UsersController extends AppController{
>var $name = 'Users';
>var $scaffold;
> }
>
> ?>
>
>
> and when i open /localhost/.../users/add
>
> in the formulary it scaffolds, the select field for profile is
> empty... so it doesnt recognize the association...
>
> can anyone help me with this basic thing??? I checked other examples
> and they are like mine!
>
> thank you
>
> PD: In the database i have some sample profiles already
>
> --
> 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
>



-- 
Kind Regards
 Stephen

 http://www.ninjacodermonkey.co.uk

-- 
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: simple auth in 2.0

2012-02-23 Thread heohni
http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-example/auth.html
Simple Authentication and Authorization Application Tutorial

On 22 Feb., 21:23, pablosky  wrote:
> Hello,
>
> I used CakePHP 1.3 and now I come to CakePHP 2.0.
>
> Do not know how to do a simple authentication system.
>
> I have this in AppController:
>
> public $components = array('Cookie', 'RequestHandler', 'Session',
> 'Auth');
>
> public function beforeFilter() {
>
>     $this->Auth->loginRedirect = array('controller' => 'index',
> 'action' => 'action_index');
>
>     if (isset($this->request->params['prefix']) && 
> $this->request->params['prefix'] == 'admin') {
>
>         $this->layout = 'admin';
>         $this->set('Auth', $this->Auth->user());
>     } else {
>         $this->Auth->allow();
>     }
>
> }
>
> If someone knows that I do wrong?
>
> 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: Index.phpController could not be found

2012-02-23 Thread Stephen Speakman

Quick summary (Do read the docs!)

www.site.com/
 - cake/libs/controllers/pages_controller.php OR CREATE
 - app/controllers/pages_controller.php
 - PagesController::display()

www.site.com/users/
 - app/controllers/users_controller.php
 - UsersController::index()

www.site.com/users/login
 - app/controllers/users_controller.php
 - UsersController::login()

Regarding pages controller never edit files in /cake/.. Override or  
extend them. (see docs)


By default you shouldn't need an index.php, you should enable mod  
rewrite and allow cakephp to read the urls correctly


Try checking your .htaccess and server config to ensure .htaccess can  
be read.


Finally the way it reads the URL

www.site.com/controller/action/param1/param2/param3

And so on, you can have as many parameters as you wish. Also check out  
routing for custom urls.


Hopefully your app will work and you can start the blog tutorial to  
learn more


Sent from my iPhone

On 22 Feb 2012, at 23:46, amg55nj  wrote:


Completely new to CakePHP. Tried doing a search with no results.

I installed CakePHP to my localhost Apache directory. Other programs  
such as PHPMyAdmin work just fine. I am getting this error:


Missing Controller

Error: Index.phpController could not be found.

Error: Create the class Index.phpController below in file: app 
\Controller\Index.phpController.php


Notice: If you want to customize this error message, create app\View 
\Errors\missing_controller.ctp




What do I do? I tried creating that PHP file and putting it in the  
app\Controller directory but that did not work.


--
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: Yn: Error: Index.phpController could not be found

2012-02-23 Thread heohni
the error is in here:
class Index.phpController extends AppController {

I guess put into your address bar localhost/index.php

just try http://localhost

On 23 Feb., 10:30, Ersin Demirtas  wrote:
> This is a really big problem people don't read the documentation. Please
> read the documentation just 15 minutes then you can understand the problem
> any problem.
>
> BlackBerry(R) PlayBook'umdan gönderildi(tm)www.blackberry.com
>
> --
> *Kimden:* "amg55nj" 
> *Kime:* "cake-php@googlegroups.com" 
> *Gönderilen:* 22 Şubat 2012 23:46
> *Konu:* Error: Index.phpController could not be found
>
> Completely new to CakePHP. Tried doing a search with no results.
>
> I installed CakePHP to my localhost Apache directory. Other programs such
> as PHPMyAdmin work just fine. I am getting this error:
>
> Missing Controller
>
> Error: Index.phpController could not be found.
>
> Error: Create the class Index.phpController below in file:
> app\Controller\Index.phpController.php
>
> 
> class Index.phpController extends AppController {
>
> }
>
> Notice: If you want to customize this error message, create
> app\View\Errors\missing_controller.ctp
>
> What do I do? I tried creating that PHP file and putting it in the
> app\Controller directory but that did not work.
>
> --
> 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: Initialize Session within a component

2012-02-23 Thread heohni
class P28nComponent extends Component {
var $components = array('Session');

On 23 Feb., 02:39, lowpass  wrote:
> > class P28nComponent extends Object {
>
> Are you using Cake 2.x? If so, update the component to extend the
> Component class instead of Object.

-- 
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: Having strange problem with debug()

2012-02-23 Thread heohni
print_r() is return all array data...
why not debug() ??

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