# |
Apr 18th 2017, 07:43 |
admad |
yes use find('first') if you want single record |
# |
Apr 18th 2017, 07:43 |
aiena |
if it is a select query returning only one row in cake 2 I can use `$model->find('first',[])` right ? |
# |
Apr 18th 2017, 07:43 |
birdy247 |
morning |
# |
Apr 18th 2017, 07:43 |
rrueco |
sorry for interruption :v: |
# |
Apr 18th 2017, 07:42 |
aiena |
admad anyway I think for this particular trivial case I can use find |
# |
Apr 18th 2017, 07:42 |
rrueco |
@admad : I made it working already by changing ...Form->create() INTO ...Form->create($user) |
# |
Apr 18th 2017, 07:40 |
aiena |
I dont have control over what my ancestors decided to do with the app so I need to work with it |
# |
Apr 18th 2017, 07:40 |
admad |
ok, hopefully someone else can help you |
# |
Apr 18th 2017, 07:40 |
aiena |
so given that constrain how do I work with query ? |
# |
Apr 18th 2017, 07:39 |
aiena |
so I cannot completely avoid query() |
# |
Apr 18th 2017, 07:39 |
aiena |
there are some postgres server side functions I need to use |
# |
Apr 18th 2017, 07:39 |
admad |
if your decision is to use query() i cant help you :slightly_smiling_face: |
# |
Apr 18th 2017, 07:38 |
aiena |
I see |
# |
Apr 18th 2017, 07:38 |
aiena |
I may decide to or not decide to use query is another decision |
# |
Apr 18th 2017, 07:38 |
admad |
not using find is why you are getting that array structure |
# |
Apr 18th 2017, 07:38 |
aiena |
that is still the question |
# |
Apr 18th 2017, 07:38 |
admad |
yes |
# |
Apr 18th 2017, 07:38 |
aiena |
thats why the select query is a tad bit easier but given the query too why do I get that result ? |
# |
Apr 18th 2017, 07:38 |
admad |
still not an excuse for using query(), that will cause you even more pain |
# |
Apr 18th 2017, 07:37 |
admad |
yes it is, since the ORM was rewritten in 3.x |
# |
Apr 18th 2017, 07:37 |
aiena |
I actually want to define a custom finder |
# |
Apr 18th 2017, 07:37 |
aiena |
yep I can do that but the find syntax in cake 2 is different |
# |
Apr 18th 2017, 07:36 |
admad |
right, don't go about adding more crap |
# |
Apr 18th 2017, 07:36 |
dakota |
Make the code better :slightly_smiling_face: |
# |
Apr 18th 2017, 07:36 |
admad |
so you have been saddled maintaining crap :slightly_smiling_face: |
# |
Apr 18th 2017, 07:35 |
aiena |
admad to be consistent with the rest of the code |
# |
Apr 18th 2017, 07:35 |
admad |
aiena: why are you using query() instead of find() for such a simple case? |
# |
Apr 18th 2017, 07:34 |
aiena |
I find this nesting structure very unusual. COsidering it is one row I expecte it to be an array containing an array of data |
# |
Apr 18th 2017, 07:32 |
aiena |
I am using cake php version 2.x (maintaining an old project). In the model when I do $this->query() I get an array of an array of an array. See http://paste.opensuse.org/73a3963d any guidance would be much appreciated |
# |
Apr 18th 2017, 07:23 |
dakota |
mampel, how you are installing it? |
# |
Apr 18th 2017, 07:22 |
rrueco |
@admad , not sure of what's happening. I have 2 controllers which uses the table. Validation is not showing in the other controller |
# |
Apr 18th 2017, 07:15 |
admad |
debug kit shows you model which use Table class instance instead of your actual class |
# |
Apr 18th 2017, 07:14 |
admad |
.. and it is being actually used |
# |
Apr 18th 2017, 07:14 |
admad |
make sure you have named the table class correct and it |
# |
Apr 18th 2017, 07:13 |
rrueco |
validation message is showing in other forms though, but to some of my forms, there's none |
# |
Apr 18th 2017, 07:13 |
rrueco |
@rchavik : I don't do redirect |
# |
Apr 18th 2017, 06:58 |
mampel |
someone help me? |
# |
Apr 18th 2017, 06:58 |
mampel |
i want to use cake php in macOS but I have some error in terminal when install php-intl |
# |
Apr 18th 2017, 06:57 |
mampel |
is there a person install intl in mac? |
# |
Apr 18th 2017, 06:57 |
mampel |
hi guys |
# |
Apr 18th 2017, 05:55 |
rchavik |
if you did a redirect, then the validation errors are lost |