# |
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 |
# |
Aug 9th 2008, 17:32 |
primeminister_ |
jaredhoyt: and then do a save without validation |
# |
Aug 9th 2008, 17:32 |
primeminister_ |
jaredhoyt: ah of course |
# |
Aug 9th 2008, 17:31 |
jezek |
so i have to load the model somewhere else? |
# |
Aug 9th 2008, 17:31 |
jaredhoyt |
if you're validating both models at the same time, it would just be something like $this->Modelx->set($this->data); $this->Modely->set($this->data); if($this->Modelx->validates() andand $this->Modely->validates()) { } |
# |
Aug 9th 2008, 17:31 |
primeminister_ |
jaredhoyt: yeah |
# |
Aug 9th 2008, 17:31 |
jaredhoyt |
primeminister: you're going to have to validate Modely the same way you do Modelx |
# |
Aug 9th 2008, 17:29 |
kjell |
Hi all! I am wondering what would be the graceful/proper way to disable a rss feed besides just sending the reader-request to dead end. Some subscribers probably won't recognize. Any advise on good practices? |
# |
Aug 9th 2008, 17:29 |
Matt1 |
jezek: http://bin.cakephp.org/view/998335493 |
# |
Aug 9th 2008, 17:29 |
jezek |
there has to be an easier way |
# |
Aug 9th 2008, 17:28 |
jaredhoyt |
*kinda |
# |
Aug 9th 2008, 17:28 |
jaredhoyt |
geez, didn't realize so many people had problems using my wizard component... i never kept up with google groups or comments... kind feel like a jerk :/ |
# |
Aug 9th 2008, 17:27 |
jezek |
i try to and it says it's not defined |
# |
Aug 9th 2008, 17:26 |
Matt1 |
jezek: propably |
# |
Aug 9th 2008, 17:25 |
jezek |
can i put it in the startup function? |
# |
Aug 9th 2008, 17:25 |
Matt1 |
jezek: access it in one function and have the other access that function ? |
# |
Aug 9th 2008, 17:23 |
jezek |
and i dont want to put that classregistry line within every function. can i put it somewhere else so the model can be accessed from every function? |
# |
Aug 9th 2008, 17:22 |
jezek |
how do i access a model within a component |