Log message #114171

# At Username Text
# Aug 9th 2008, 17:51 jaredhoyt i added $this->User = ClassRegistry::init('User'); to a component startup and pr($this->User->findById(1)); to the method, and it worked just fine
# Aug 9th 2008, 17:51 jezek mm
# Aug 9th 2008, 17:51 jezek really
# Aug 9th 2008, 17:50 jaredhoyt clear your cache maybe
# Aug 9th 2008, 17:50 jaredhoyt hmm, works fine for me
# Aug 9th 2008, 17:48 jezek null
# Aug 9th 2008, 17:45 jaredhoyt yeah, try http://bin.cakephp.org/view/1303690479
# Aug 9th 2008, 17:43 jezek nope
# Aug 9th 2008, 17:43 jaredhoyt are you defining the variable outside of startup() as well? like $userInstance = null; or whatever
# Aug 9th 2008, 17:42 jezek ok
# Aug 9th 2008, 17:41 jaredhoyt or whatever model it is
# Aug 9th 2008, 17:41 jezek the name of the variable?
# Aug 9th 2008, 17:41 jaredhoyt don't know if it loads it automatically into the class with the same name... try $this->userInstance = ...
# Aug 9th 2008, 17:41 jaredhoyt maybe try changing the name... i'm not 100% how init() works...
# Aug 9th 2008, 17:41 jezek yeah it works fine that way
# Aug 9th 2008, 17:40 jaredhoyt like it is in the manual
# Aug 9th 2008, 17:39 jaredhoyt jezek: did you try just instantiating the model in the method first?
# Aug 9th 2008, 17:39 JD__ so it looks llke i need to make a new profile object, load the data, run validation, then resave everything else
# Aug 9th 2008, 17:39 JD__ Im dying there because i have model validation in my profile object.. the save silently fails
# Aug 9th 2008, 17:39 jaredhoyt hmmm
# Aug 9th 2008, 17:38 jezek http://bin.cakephp.org/view/1303690479
# Aug 9th 2008, 17:38 jaredhoyt JD__: have you tried http://book.cakephp.org/view/66/models#saving-related-model-data-haso-84
# Aug 9th 2008, 17:37 jezek "Call to a member function findById() on a non-object i"
# Aug 9th 2008, 17:37 jezek i'll try that
# Aug 9th 2008, 17:37 JD__ Is there a book.cakephp.org articale or bakery article regarding saving models recursivley? I have a user object with a profile memebr object, and it seems pretty crazy making two objects , running the validation, and saving. I have a big mess now that doesn't work, I have been looking for some docs on it but have have come up empty
# Aug 9th 2008, 17:37 jaredhoyt $this->User = ClassReg...
# Aug 9th 2008, 17:36 jaredhoyt just have to set it to a class var instead of function var
# Aug 9th 2008, 17:36 jaredhoyt no, you could do it in the startup() or initialize()
# Aug 9th 2008, 17:36 jezek do i have to put $userInstance = ClassRegistry::init('User'); within every function?
# Aug 9th 2008, 17:36 jezek yeah
# Aug 9th 2008, 17:35 jaredhoyt jezek: have you read the last section of this : http://book.cakephp.org/view/62/components#mvc-class-access-within-components-65
# Aug 9th 2008, 17:34 jezek i'd rather not have to
# Aug 9th 2008, 17:34 jezek he just asked that
# Aug 9th 2008, 17:34 jezek no
# Aug 9th 2008, 17:34 jaredhoyt jezek: are you trying to access a model that is included in the $uses of the component's calling controller?
# Aug 9th 2008, 17:34 jezek i guess i could
# Aug 9th 2008, 17:34 jezek no
# Aug 9th 2008, 17:33 jaredhoyt np
# Aug 9th 2008, 17:32 primeminister_ jaredhoyt: thnx!
# Aug 9th 2008, 17:32 Matt1 jezek: you are calling it from a controller, right ?
# Aug 9th 2008, 17:32 jaredhoyt right