# |
Apr 18th 2017, 07:49 |
aiena |
hmic, yes I know of cakes conventions I was learning cake from cake 3 though. I applied that knowledge to cake 2 seeing what changed etc. Still learning as I work on this |
# |
Apr 18th 2017, 07:49 |
hmic |
if you are starting new apps, don't base them on 2.x! especially the ORM got so much better with 3.x! |
# |
Apr 18th 2017, 07:48 |
hmic |
will save you time from day one! |
# |
Apr 18th 2017, 07:48 |
hmic |
thats not what we are saying. we are saying: learn cake and use it! |
# |
Apr 18th 2017, 07:48 |
aiena |
but I like cake I'll make a few other apps in it as practice |
# |
Apr 18th 2017, 07:48 |
aiena |
but I am pretty new to frameworks so a recode could also goof up |
# |
Apr 18th 2017, 07:47 |
aiena |
hmic, I agree if I had the time I would recode the whole thing |
# |
Apr 18th 2017, 07:46 |
hmic |
still admad is 100% correct: stop the crap! NOW |
# |
Apr 18th 2017, 07:46 |
hmic |
so if you change the select master_name ... to select $prefix_master_table.master_name you get it "right" at least. |
# |
Apr 18th 2017, 07:45 |
aiena |
hmic, honestly this is the first framework I'm actually using I am so used to PDO arrays |
# |
Apr 18th 2017, 07:45 |
hmic |
the third array hold the columns you select |
# |
Apr 18th 2017, 07:45 |
hmic |
for this to work your selected fields need to include the alias too |
# |
Apr 18th 2017, 07:45 |
hmic |
the second array holds the alias of the table you are querieing |
# |
Apr 18th 2017, 07:44 |
aiena |
hmic, nods, but I cant control conventions here inherited app |
# |
Apr 18th 2017, 07:44 |
hmic |
the first array holds the results, one numeric index per row |
# |
Apr 18th 2017, 07:44 |
hmic |
your resulting array would not look as weird |
# |
Apr 18th 2017, 07:44 |
hmic |
aiena, if you would build a query that adheres to the cake conventions |
# |
Apr 18th 2017, 07:43 |
adityapansari |
Any link to post data using jQuery. I have already that function in cakephp |
# |
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 |