Hi,
Thanks for help.
Where do you place this function - in beforesave of model Photo?
And what is
// You can do $this->create() here
?
On 30 Янв., 14:59, "Dr. Tarique Sani" <[EMAIL PROTECTED]> wrote:
>This is what I do - before I save the Photo which HABTM Tag and use
> the returned array of ids in Photos
>
> function parseTags($tagString){
> $tags = explode(",",trim($tagString));
> foreach($tags as $tag){
> if(!empty($tag)){
>
> $this->unbindModel(array('hasAndBelongsToMany'=>array('Photo')));
> $tagRow = $this->findByTag($tag);
> if(is_array($tagRow)){
> // You can do $this->create() here
> $ids[] = $tagRow['Tag']['id'];
> }else{
> //Code to insert the new tag
> $newTag['Tag']['tag']=trim($tag);
> $newTag['Tag']['id']="";
> $this->save($newTag);
> $ids[]=$this->getLastInsertId();
> }
> }
> }
> return $ids;
> }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---