For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > March 2006 > Problem with DBDOFB and fb_crossLinks









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Problem with DBDOFB and fb_crossLinks
Jose Manuel Zea

2006-03-20, 6:57 pm

Hi:

I=B4m using PHP5 and the last version of DBDOFB, and I have the =
following
tables:

CREATE TABLE `collection` (
`collection_id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(30) NOT NULL default '',
PRIMARY KEY (`collection_id`)
) ENGINE=3DMyISAM DEFAULT CHARSET=3Dlatin1

CREATE TABLE `collection2permission` (
`collection_id` int(10) unsigned NOT NULL default '0',
`permission_id` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`collection_id`,`permission_id`)
) ENGINE=3DMyISAM DEFAULT CHARSET=3Dlatin1

CREATE TABLE `permission` (
`permission_id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(30) NOT NULL default '',
`description` varchar(100) default NULL,
PRIMARY KEY (`permission_id`)
) ENGINE=3DMyISAM DEFAULT CHARSET=3Dlatin1

Collection2permission, it=B4s the linking table.

And for the Collection Form, I need a checkbox for every permission =
filled
in the correspondent table.

So, I defined the following in my collection.php file:

var $fb_crossLinks =3D array(array('table' =3D> =
'Collection2permission', =20
'fromField' =3D> 'collection_id',
'toField' =3D> 'permission_id'));

And, it=B4s working. But the problem is when I post the form, it =
dosen=B4t work
properly, because whe I check or uncheck the items, it doesn=B4t create =
or
delete the relationships in the linking table.

One thing I discovered, trying to debug what is happening it=B4s that in =
the
line number 2763 in the file FormBuilder.php, sanitizeFieldName returns =
the
value '__crossLink_Collection_permission_colle
ction_id_permission_id' =
and
the field in $editableFields is
" __crossLink_Collection2permission_collec
tion_id_permission_id", the
difference it=B4s a 2 in the middle of the word. So, the conditional if
(in_array($crossLinkName, $editableFields)) it=B4s going to be always =
false.

What I commented this line, trying to see if the problem was that I =
cannot
name a table using a number, but it=B4s still not working.

Can anyone help me, please? I don=B4t know what else to do.

Thank you in advance.

Regards,=20
Jose Manuel Zea





________________________________________
______
LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com
Jose Manuel Zea

2006-03-21, 7:56 am



in
the[color=darkred]
returns
the[color=darkred]
and[color=darkred]
if[color=darkred]
false.[color=darkred]
cannot[color=darkred]
[color=darkred]
>Try using __crossLink_Collection_permission_collec
tion_id_permission_id
>in userEditableFields. Or use $fb->_sanitizeFieldNames() on your

vcrossLink name.

>--
>Justin Patrin


Well, I=B4m not defining the userEditableFields, it=B4s automatically =
created,
but when I do in this way:

var $fb_userEditableFields =3D
array('collection_id','name','__crossLin
k_Collection_permission_collectio=
n_i
d_permission_id');

as you said, I=B4m including a function to see the content of the array =
before
the line I mentioned before, and the result is:

* 0 =3D> collection_id
* 1 =3D> name

so it=B4s still not working.

Without defining it, the result is:

* 0 =3D> collection_id
* 1 =3D> name
* 2 =3D> =
__crossLink_Collection2permission_collec
tion_id_permission_id

With respect to using $fb->_sanitizeFieldNames() on the vcrossLink name, =
I
don=B4t know where and how to implement it.

Jose Manuel Zea=20



________________________________________
______
LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com