Re: initialize model link make the apps very slow

2010-03-12 Thread Mukhamad Ikhsan
this link can explain briefly about my problem

http://abing.gotdns.com/posts/2006/lazy-loaded-models-for-cakephp/

but i'm still find the solution, or cakephp is designed for only few to
medium number of tables?

On Fri, Mar 12, 2010 at 8:32 PM, Mukhamad Ikhsan wrote:

> my model has 100+ with many relation, more than 30s just for add user page,
> i'm using 1.2.6
>
>
> On Wed, Mar 10, 2010 at 3:55 PM, WebbedIT  wrote:
>
>> How slow is slow in your case?  I am running apps with 50+ models
>> quite happily using 1.2.5 and slightly smaller apps on 1.2.6 without
>> issue.
>>
>> Check out the new CakePHP Questions site http://cakeqs.org and help
>> others with their CakePHP related questions.
>>
>> You received this message because you are subscribed to the Google Groups
>> "CakePHP" group.
>> To post to this group, send email to cake-php@googlegroups.com
>> To unsubscribe from this group, send email to
>> cake-php+unsubscr...@googlegroups.comFor
>>  more options, visit this group at
>> http://groups.google.com/group/cake-php?hl=en
>>
>
>
>
> --
> Mukhamad Ikhsan
> Y!id:ikhsan_only
> http://www.diodachi.com
>



-- 
Mukhamad Ikhsan
Y!id:ikhsan_only
http://www.diodachi.com

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en


Re: initialize model link make the apps very slow

2010-03-12 Thread Mukhamad Ikhsan
my model has 100+ with many relation, more than 30s just for add user page,
i'm using 1.2.6

On Wed, Mar 10, 2010 at 3:55 PM, WebbedIT  wrote:

> How slow is slow in your case?  I am running apps with 50+ models
> quite happily using 1.2.5 and slightly smaller apps on 1.2.6 without
> issue.
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>



-- 
Mukhamad Ikhsan
Y!id:ikhsan_only
http://www.diodachi.com

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en


initialize model link make the apps very slow

2010-03-09 Thread Mukhamad Ikhsan
when build small apps with a few table and model relation, the
responsiveness of apps is still usable, but now when i creating many
tables with many relation, the apps is incredibly slow.

then i'm tryng to find how why the apps is very slow, and i find this flow :
bootstrap -> dispatcher -> invoke -> constructor -> loadModel, i know
even on bootstrap and dispatch the process has take a quite long
enough but is worse when loading the model, the process recursively
creating the object model that associate with model controller.

so even for a little task, cakephp always 'preparing' the worst case,
generate all relation that defined on model class. in my case (many
tables with many association defined) the bottleneck is in model
objects creation, not on the query process.

it's there a best practice to make just initialize needed model, but
still easy to maintain than by using recursive 0, and bind one by one
on the code, or worst by using app::import model on every call.

thank's





-- 
Mukhamad Ikhsan
Y!id:ikhsan_only
http://www.diodachi.com

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en


Re: Access Global Function in CakePHP

2010-02-11 Thread Mukhamad Ikhsan
$temp_var = __('String', true);
$temp_var is not a function just a returned value, if a i calling many
function __() with different value it can't be implemented like this

i created javascript helper that intensively using string manipulation so
curly string syntax is making easier and make a cleaner code. so now i'm
facing a problem when combining curly syntax and __() function that was a
global function.

On Thu, Feb 11, 2010 at 3:18 PM, Miles J  wrote:

> Not everything has to be OOP. Im still confused at what your trying to
> achieve.
>
> On Feb 10, 11:39 pm, Martin Westin  wrote:
> > I can not imagine why you would use a localized variable variable.
> > Anyway...
> >
> > $temp_var = __('String',true);
> > echo "{${$temp_var}}";
> >
> > On Feb 11, 8:14 am, Mukhamad Ikhsan  wrote:
> >
> > > global function like __() is break the OOP concept, in some cases i
> need the
> > > function bind to an object
> >
> > > case:
> > > echo "{${$someobject->__('String')}}" // This will work
> > > echo "{${__('String')}} // this will not work because curly syntax
> after ${
> > > is looking the variable object not a function, even in php manual this
> > > should work but i have tried and it's not worked
> >
> > > but because __() is a global function, i don't know how to bind that
> > > function into a variable/object
> >
> > > --
> > > Mukhamad Ikhsan
> > > Y!id:ikhsan_only
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>



-- 
Mukhamad Ikhsan
Y!id:ikhsan_only
http://www.diodachi.com

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en


Access Global Function in CakePHP

2010-02-10 Thread Mukhamad Ikhsan
global function like __() is break the OOP concept, in some cases i need the
function bind to an object

case:
echo "{${$someobject->__('String')}}" // This will work
echo "{${__('String')}} // this will not work because curly syntax after ${
is looking the variable object not a function, even in php manual this
should work but i have tried and it's not worked

but because __() is a global function, i don't know how to bind that
function into a variable/object

-- 
Mukhamad Ikhsan
Y!id:ikhsan_only

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en


Re: Share Javascripts and CSSs in various layouts

2009-12-11 Thread Mukhamad Ikhsan
i found someone write helper for that

http://bakery.cakephp.org/articles/view/asset-mapper

i create some modification to support bottomscript and bottom codeblock (in
case need script that load on the end of the page). also change asset rule
action with regex filter.

and sometimes we need to define a css files after one script, or a codeblock
after other script and vice versa, or in other words the sequence is really
important. so i also change the behaviour of rendering script/css/codeblock,
the rendering will rendered follow the sequence of AssetRule defined in
asset.map.config.php

also change the location of asset rule to config/asset.map.config.php

On Sat, Dec 12, 2009 at 2:23 AM, thomaus  wrote:

> The problem is that not all the pages will have the ame structure,
> some will call header, some not, ... but yes it's feasible.
>
> This aid, I'd like to know how to share CSS and JS.
>
> On Dec 11, 7:57 pm, pomares  wrote:
> > How about creating a custom layout and calling it from the controller
> > with: $this->layout = 'customlayout';
> >
> > Here is a custom layout I wrote with a bunch of css and javascript
> > calls:
> >
> >  http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
> > http://www.w3.org/1999/xhtml";>
> > 
> > charset(); ?>
> >  > title>
> >
> >  > echo $html->meta('icon');
> >
> > echo $html->css('admin-staff-layout');
> > echo $html->css('admin-staff');
> >
> > echo $html->css('SpryCollapsiblePanel');
> > echo $html->css('SpryTabbedPanels');
> > echo $html->css('SpryAccordion');
> >
> > echo $javascript->link('SpryCollapsiblePanel');
> > echo $javascript->link('SpryTabbedPanels');
> > echo $javascript->link('SpryAccordion');
> >
> > echo $javascript->link('prototype');
> > echo $javascript->link('scriptaculous');
> >
> > echo $scripts_for_layout;
> > ?>
> >
> > 
> > 
> >
> > element('topnav')?>
> >
> > 
> > 
> > 
> > flash(); ?>
> >  
> > 
> > 
> > 
> > 
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>



-- 
Mukhamad Ikhsan
+6281572181283
Y!id:ikhsan.only
http://www.diodachi.com

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
<>
<>
<>
<>


Re: Testing for Ajax

2009-12-11 Thread Mukhamad Ikhsan
on your action controller you can put this conditional

if ($this->RequestHandler->isAjax())  {}

in view you need consider this,
on ajax development you still need consider about graceful degradation, so
in every link there must consider if the javascript is not working.

http://www.xxx.com"; onClick="request.open('http://www.xxx.com";);return
false" />
on default, javascipt will be executed but the link is still work in classic
way.

On Fri, Dec 11, 2009 at 11:16 AM, Jeremy Burns  wrote:

> Thank you - I don't suppose you have a simple example do you?
>
> On Dec 11, 4:12 am, "Dr. Loboto"  wrote:
> > Pass one URL to AJAX link as link url and other to it's options as
> > AJAX action param.
> >
> > On Dec 10, 11:37 pm, Jeremy Burns  wrote:
> >
> >
> >
> > > Thank you, but that isn't working for me. I have a link that retrieves
> > > some data and populates a div with an element. With Javascript
> > > disabled I just get the contents of the element in an otherwise blank
> > > screen. What I want to do is something like this:
> >
> > > If (javascript is enabled):
> > > show this link
> > > else
> > > show another link
> > > end if
> >
> > > So what I am looking for is a nifty little piece of code to do the "if
> > > javascript is enabled" bit.
> >
> > > On Dec 10, 5:27 pm, "Dr. Loboto"  wrote:
> >
> > > > AJAX links and forms in Cake AJAX helper has fallback. If JS is not
> > > > enabled links/forms will work as normal ones.
> >
> > > > On Dec 10, 6:58 pm, Jeremy Burns  wrote:
> >
> > > > > I want to use the Ajax helper when Javascript is enabled, but
> revert
> > > > > to the plain old ordinary html helper when it is not. How can I do
> a
> > > > > simple test to see if Javascript is enabled?
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>



-- 
Mukhamad Ikhsan
Y!id:ikhsan.only
http://www.diodachi.com

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en


Re: Problem with AJAX submission

2009-12-11 Thread Mukhamad Ikhsan
do you have a firebug? you can see what the response for XHR request

On Fri, Dec 11, 2009 at 4:57 PM, thomaus  wrote:

> Nobody no clue?
>
> On Dec 10, 10:04 am, thomaus  wrote:
> > Hi John,
> >
> > I just did and... still nothing at all when clicking!
> >
> > Thanks,
> >
> > On Dec 10, 7:20 am, John Andersen  wrote:
> >
> > > Have you added the javascript libraries?
> > > - prototype
> > > - scriptaculous
> >
> > > Enjoy,
> > >John
> >
> > > On Dec 9, 9:03 pm, thomaus  wrote:
> >
> > > > Hi John,
> >
> > > > Thanks for helping.
> >
> > > > I actually made a mistake when pasting the code. The original trial
> > > > was
> >
> > > > submit(__('send', true), array('url'=> array
> > > > ('controller'=>'users', 'action'=> 'recoverPassword'), 'class'=>
> > > > 'button', 'update' => 'messages')); ?>
> >
> > > > and the same happens, basically nothing nothing at all when I click
> on
> > > > the Send button.
> >
> > > > Don't know if it helps but here is the corresponding generated HTML
> > > > code :
> >
> > > >  > > > value="Send" id="submit116667344" onclick="event.returnValue = false;
> > > > return false;" />
> > > > //<![CDATA[
> > > > Event.observe("submit116667344", 'click', function(event) { new
> > > > Ajax.Updater('messages','/MyApp/html/users/recoverPassword',
> > > > {asynchronous:true, evalScripts:true, parameters:Form.serialize
> > > > (Event.element(event).form), requestHeaders:['X-Update',
> > > > 'messages']}) }, false);
> > > > //]]>
> > > > 
> > > > 
> > > > 
> >
> > > > Thanks,
> >
> > > > On Dec 9, 6:42 pm, John Andersen  wrote:
> >
> > > > > I do observe that your ajax->submit is supposed to call your
> "login"
> > > > > action in your "users" controller and not your "recoverPassword"
> > > > > action!
> > > > > Please check your code or your statement :)
> > > > > Enjoy,
> > > > >John
> >
> > > > > On Dec 9, 3:03 pm, thomaus  wrote:
> >
> > > > > > Hi there,
> >
> > > > > > I just built an AJAX form and it doesn't work at all!
> >
> > > > > > My code:
> >
> > > > > > 
> > > > > > Recover lost password
> > > > > > Enter your e-mail address and we will send a reset link to
> your
> > > > > > email
> > > > > > create('User'); ?>
> > > > > > input('email',
> array('label' => __('Your
> > > > > > Email', true), 'class' => 'text-input')); ?>
> > > > > > 
> >
> > > > > > submit(__('Send',
> true),
> > > > > >
>   array('url'=> array('controller'=>'users', 'action'=>
> > > > > > 'login'),
> > > > > >
>   'class'=> 'button',
> > > > > >
>   'update' => 'messages')); ?>
> >
> > > > > > end(); ?>
> > > > > >  
> >
> > > > > > The button appears and when I click on it, absolutely nothing
> happens
> > > > > > while if I type myapp/users/recoverPassword in my browser it of
> course
> > > > > > calls my controller correctly.
> >
> > > > > > Thanks in advance,
> >
> > > > > > thomas...
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>



-- 
Mukhamad Ikhsan
Y!id:ikhsan.only
http://www.diodachi.com

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en


HABTM in 1.2.5?

2009-10-20 Thread Mukhamad Ikhsan
Is in this version there still not any configuration (adding parameter) to
save function on HABTM relation type? on the default, the model->save on
HABTM function is replace the records...delete and insert, not update
without delete (just adding), i've just read the article
http://bakery.cakephp.org/articles/view/add-delete-habtm-behavior , but that
an old article so i try to looking into the source, but i think the
model->save() in HABTM is still same, not provide with any parameter
exclusively for HABTM.

-- 
Mukhamad Ikhsan
http://www.diodachi.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~--~~~~--~~--~--~---



Re: Password field is automatically hashed, how to change this?

2009-10-02 Thread Mukhamad Ikhsan
and how to set new name a form field but different with database fieldname,
but still mapping automatically? in my case, password is a field on users
table, if i change the code in view "$this->input('passwordkey');" that form
field is not mapping with password field on users table, how to still
mapping both of them?

i wan't to change the field on users table, because the $this->Auth->login()
hard coded the checking using 'username' and 'password' field name on users
table, it's annoying if create own login function.

Thank's before for reply

On Thu, Oct 1, 2009 at 1:15 PM, Bert Van den Brande wrote:

> As far is I know there is no configuration for this, a workaround is to
> name your password form fields not 'password'. Keep in mind that you have to
> manually hash the passwords then using $this->Auth->password($your_password)
>
>
> On Thu, Oct 1, 2009 at 7:56 AM, Mukhamad Ikhsan wrote:
>
>> I have a password field that when submiting, the value is already hashed.
>> before, I'm not really concider with this problem, but now i realize because
>> of that, the validation for 'notEmpty' is break. Even i enter the empty,
>> Cake automated hashed the empty value so i never get validation error for
>> notEmpty in password field. There is some configuration for this?
>>
>> --
>> Mukhamad Ikhsan
>> http://www.diodachi.com
>>
>>
>>
>
> >
>


-- 
Mukhamad Ikhsan
+6281572181283
Y!id:ikhsan.only
http://www.diodachi.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~--~~~~--~~--~--~---



Password field is automatically hashed, how to change this?

2009-09-30 Thread Mukhamad Ikhsan
I have a password field that when submiting, the value is already hashed.
before, I'm not really concider with this problem, but now i realize because
of that, the validation for 'notEmpty' is break. Even i enter the empty,
Cake automated hashed the empty value so i never get validation error for
notEmpty in password field. There is some configuration for this?

-- 
Mukhamad Ikhsan
http://www.diodachi.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~--~~~~--~~--~--~---



Re: problem with facebook-like ajax windows submitting forms

2009-09-18 Thread Mukhamad Ikhsan
recently my friends explore about how to upload file via AJAX, but he founds
that AJAX can't upload a file (look the on the W3C description about
XMLHTTPRequest). about upload file without creating iframe, we need other
mechanism like using java applet or flash, and for facebook my friend tell
me that facebook using java for uploading the file, but i'm not checked
before about that.

On Sat, Sep 19, 2009 at 10:16 AM, 浪漫様  wrote:

>
> "cheating by using an iframe doesn't mean you're submitting your
> dialog-forms by ajax"
> -> well, i didn't say i was using an iFrame to do ajax :P i know it
> doesn't work like that... i only said that as i couldn't do the
> ajaxForm on the popup window, the solution i found was using an iFrame
> to send the form as a normal form... but as you may think, i didn't
> like that solution... that's why i asked how to do it with ajax
> instead of iFrame :P hehe
>
> thanks anyway,
>
> Rohman
>
> On Sep 19, 2:05 am, AD7six  wrote:
> > On 18 sep, 15:13, 浪漫様  wrote:
> >
> > > no problem. thank you anyway
> >
> > > Rohman
> >
> > Walter and Bert have already given you your answer (yes, I've read
> > your question and no, cheating by using an iframe doesn't mean you're
> > submitting your dialog-forms by ajax)
> >
> > Seehttp://
> docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_st...
> > to understand why your ajaxforms work when they are in the first http
> > request, but don't if they are part of an ajax response.
> >
> > hth,
> >
> > AD
> > PS. why, especially if you're using jquery, are you using a helper to
> > write such ugly js :)?
> > Something you might want to use as a comparison:
> http://trac.assembla.com/mi/browser/branches/mi_js/jquery.mi_dialogs
> > Which, is the same js code (more or less) on book.cakephp.org - which
> > will probably serve as a useful example to follow
> >
>


-- 
Mukhamad Ikhsan
+6281572181283
Y!id:ikhsan.only
http://www.diodachi.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~--~~~~--~~--~--~---



Re: how to call method from another controller?

2009-09-11 Thread Mukhamad Ikhsan
when you declare a function on app_controller, that means you instantiate
that function in every instants of controller.

if every we need something we put the function on app_controller, i thin'k
that increase the memory overhead, plus we don't correlate the function
within related class.

but it's odd to calling other function on other controller, many cases is
calling a function on component/vendor. on MVC paradigm, as far i know the
controller is just 'passing message' (become a driver) between view <-> data
so for other functionalities we can create other classes (component, vendor
e.g : pdf, filehandler, etc).


On Thu, Sep 10, 2009 at 11:42 PM, Miles J  wrote:

>
> Well whats the problem with putting it in the AppController? Its your
> application, so it should be no problem in being global and having
> someone "access" it.
>
> If its an action that outputs the same view and contents, then perhaps
> you should rethink how it works.
>
> On Sep 10, 1:09 am, Tokasa  wrote:
> > Hi Miles,
> > What is wrong on Mukhamad's idea?
> >
> > But what would you suggest, if you'd like to call some other
> > controller's method but you dont want to put it globaly in
> > app_controller??
> >
> > Thanks
> > Tomas
> >
> > On Sep 9, 6:18 pm, Miles J  wrote:
> >
> > > Do not listen to Mukhamad Ikhsan, that way is extremely wrong.
> >
> > > Simply place the method you want to use in the AppController, or
> > > within a component.
> >
> > > On Sep 9, 6:38 am, Mukhamad Ikhsan  wrote:
> >
> > > > initialize to local variable, $variable = App::import('Controller',
> > > > array('example'));
> >
> > > > $variable->method
> >
> > > > On Wed, Sep 9, 2009 at 8:36 PM, Mukhamad Ikhsan <
> ikhsan.o...@gmail.com>wrote:
> >
> > > > > App::import('Controller', array(...));
> >
> > > > >
> http://book.cakephp.org/view/531/Importing-Controllers-Models-Compone...
> >
> > > > > On Wed, Sep 9, 2009 at 3:50 PM, toka...@gmail.com <
> toka...@gmail.com>wrote:
> >
> > > > >> Hi, how can I call method from another controller?
> >
> > > > >> I have read somthing about requestAction(...) but in help they say
> ...
> > > > >> "It is rarely appropriate to use in a controller or model."
> >
> > > > >> Is there other better way??
> >
> > > > >> Thanks
> > > > >> Tomas
> >
> > > > --
> > > > Mukhamad Ikhsan
> > > > +6281572181283
> > > > Y!id:ikhsan.onlyhttp://www.diodachi.com
> >
>


-- 
Mukhamad Ikhsan
+6281572181283
Y!id:ikhsan.only
http://www.diodachi.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~--~~~~--~~--~--~---



Re: model->saveAll is only for add(create)?

2009-09-10 Thread Mukhamad Ikhsan
I see, so we also needed to provide the id of 'children' (TelephonyNumber)
that belongs to the 'parent' (Person). but i have a different problem, in my
case, i also can adding some ShiftDetail (child), on the page, but not to
create a new Shift (parent) just adding the ShiftDetail to the exist Shift.

but i now get the understanding, when i don't provide the id for ShiftDetail
on the form, Cake will just create new Shift (parent) and correlate that
ShiftDetail with the new Shift, even i triggered on the exist Shift
(shifts/edit/1).

To my problem. i'm going to 'pragmatic' approach on the edit function on
controller

if ($this->Shift->save($this->data)) { // to update the Shift (parent)
   //adding new ShiftDetail to the current Shift
   $this->Shift->ShiftDetail->saveAll($this->data, array('validate' =>
'first'));
}

Thank's, now i know why saveAll didn't work before. but i still wonder if
the process can done in one function $this->Shift->saveAll, to update +
adding (if users add new).


On Thu, Sep 10, 2009 at 3:59 PM, WebbedIT  wrote:

>
> Here is one of my forms which updates a Person model and User
> (hasOne), TelephonyNumber (hasMany) and OnlineAddress (hasMany)
>
> Edit View:
>
> echo $form->create('Person');
>  echo $form->input('Person.id');
>  echo $form->input('Person.title_id');
>  echo $form->input('Person.first_name');
>  echo $form->input('Person.middle_name');
>  echo $form->input('Person.last_name');
>  echo $form->input('Person.gender_id');
>  echo $this->element('date_jscalendar', array
> ('id'=>'PersonDateOfBirth', 'model'=>'Person',
> 'field'=>'date_of_birth', 'label'=>'Date of Birth'));
>  echo $form->input('TelephonyNumber.0.id');
>  echo $form->input('TelephonyNumber.0.parent_model', array
> ('type'=>'hidden', 'value'=>'Person'));
>  echo $form->input('TelephonyNumber.0.type_id', array
> ('type'=>'hidden', 'value'=>51));
>  echo $form->input('TelephonyNumber.0.number', array
> ('label'=>'Telephone'));
>  echo $form->input('OnlineAddress.0.id');
>  echo $form->input('OnlineAddress.0.parent_model', array
> ('type'=>'hidden', 'value'=>'Person'));
>  echo $form->input('OnlineAddress.0.type_id', array('type'=>'hidden',
> 'value'=>54));
>  echo $form->input('OnlineAddress.0.address', array
> ('label'=>'Email'));
>  echo $form->input('User.id');
>  echo $form->input('User.username');
>  echo $form->input('User.password', array('value'=>'', 'label'=>'New
> Password'));
>  echo $form->input('User.password_confirm', array('type'=>'password',
> 'label'=>'Confirm Password', 'value'=>''));
>  echo $form->input('User.is_active', array('label'=>'Active',
> 'options' => array('1' => 'Yes', '0' => 'No')));
>  echo $form->input('User.is_deleted', array('label'=>'Deleted',
> 'options' => array('0' => 'No', '1' => 'Yes')));
>  echo $form->input('User.user_group_id');
> echo $form->end('Submit');
>
> Controller:
>
> if ($this->Person->saveAll($this->data, array('validate'=>'first'))) {
>  $this->Session->setFlash('User updated');
>  $this->redirect('view/'.$this->Person->id);
> } else {
>  $this->Session->setFlash('User not updated, correct errors and
> resubmit');
> }
>
> Simple, just make sure you have the right ID values included in the
> form.
>
> P.S. The TelephonyNumber and OnlineAddress form fields are named
> differently due to their hasMany associations
> >
>


-- 
Mukhamad Ikhsan
+6281572181283
Y!id:ikhsan.only
http://www.diodachi.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~--~~~~--~~--~--~---



Re: how to call method from another controller?

2009-09-09 Thread Mukhamad Ikhsan
initialize to local variable, $variable = App::import('Controller',
array('example'));

$variable->method

On Wed, Sep 9, 2009 at 8:36 PM, Mukhamad Ikhsan wrote:

> App::import('Controller', array(...));
>
>
> http://book.cakephp.org/view/531/Importing-Controllers-Models-Components-Behaviors-
>
>
> On Wed, Sep 9, 2009 at 3:50 PM, toka...@gmail.com wrote:
>
>>
>> Hi, how can I call method from another controller?
>>
>> I have read somthing about requestAction(...) but in help they say ...
>> "It is rarely appropriate to use in a controller or model."
>>
>> Is there other better way??
>>
>> Thanks
>> Tomas
>> >>
>>
>
>
>
>


-- 
Mukhamad Ikhsan
+6281572181283
Y!id:ikhsan.only
http://www.diodachi.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~--~~~~--~~--~--~---



model->saveAll is only for add(create)?

2009-09-09 Thread Mukhamad Ikhsan
I have a class model

1. Shift -> has many ShiftDetail
2. ShiftDetail -> belongs to Shift

i was creating page for add Shift that has also can create shift detail on
the same page (using ajax)

in the controller i using saveAll to save that data,

if ($this->Shift->validates()) {
if ($this->Shift->saveAll($this->data, array('validate'
=> 'first')))

and it's work, but the problem is, where i need to update with same approach
like adding Shift+ShiftDetail
when i call, $this->Shift->saveAll($this->data.cake not updated but
creating new Shift -_-

to locating the culprit, i testing many possibilities, and nothing wrong
with view/model,
so i try to change Model->saveAll with Model->save, and voila cake
understand and updated the data not adding

so i concluding that method saveAll is not for updating but just to creating
the has many model relationship

http://book.cakephp.org/view/84/Saving-Related-Model-Data-hasOne-hasMany-belongsTo

on above link, cake not mention about updating the model, so i still
wandering if it's still can use saveAll for updating the data?

there's someone has creating ticket for similar problem, but the solutions
is going to (works-for-me)...and still doesn't work for me

http://code.cakephp.org/tickets/view/53

it's anyone has already tried to use saveAll for update data before?


-- 
Mukhamad Ikhsan
Y!id:ikhsan.only
http://www.diodachi.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~--~~~~--~~--~--~---



Re: how to call method from another controller?

2009-09-09 Thread Mukhamad Ikhsan
App::import('Controller', array(...));

http://book.cakephp.org/view/531/Importing-Controllers-Models-Components-Behaviors-

On Wed, Sep 9, 2009 at 3:50 PM, toka...@gmail.com  wrote:

>
> Hi, how can I call method from another controller?
>
> I have read somthing about requestAction(...) but in help they say ...
> "It is rarely appropriate to use in a controller or model."
>
> Is there other better way??
>
> Thanks
> Tomas
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~--~~~~--~~--~--~---