alias for inst ?

alias for inst ?

LapointeLapointe Posts: 430Questions: 81Answers: 4

hi

is there a way to alias this in php class Editor::inst( $db, $TblName )
for example Editor::inst( $db, $TblName as 'tbl') or Editor::inst( $db, $TblName )->name('tbl') or ???

Thank

Bob

This question has accepted answers - jump to:

Answers

  • allanallan Posts: 61,438Questions: 1Answers: 10,052 Site admin

    I don't quite understand I'm afraid - are you looking to alias the table name? If so try:

    Editor::inst( $db, $TblName .' as tbl')
    

    However it isn't something we use extensively, so it is possible there might be a few rough edges.

    Allan

  • LapointeLapointe Posts: 430Questions: 81Answers: 4

    hi @allan

    Yes it was what I was looking for... I use .data files that describe datas, .def that describe associated table and editor...

    With many table in a dataset, fields do have prefix using table name.

    So when I want to test a way using a view, the stable name used for tests change, and I need to change fields definition in .def files.

    So using alias I can reuse fields definitions with no change at all...

    I did test $Table as 'tbl', missing table name must be a string

    Sometimes I'm better... and this is not really difficult to be

    Thanks
    Bob

  • json81json81 Posts: 24Questions: 6Answers: 1

    It is not possible to use alias for primary table in PHP. DELETE-statement doesn't handle it. You can only have alias for the joined tables.

    A fix were planned for editor 1.9.3 but it still doesn't work:
    https://datatables.net/forums/discussion/59528

  • LapointeLapointe Posts: 430Questions: 81Answers: 4

    hi @json81

    Did you test the delete from alias now (2.0.1) ?

    Bob ?

  • json81json81 Posts: 24Questions: 6Answers: 1
    Answer ✓

    Hi!
    I have tried 1.9.3, 1.9.6 and 2.0.1.

    /Anders

  • LapointeLapointe Posts: 430Questions: 81Answers: 4

    Hi

    I'll try ASAP

    Thanks

  • allanallan Posts: 61,438Questions: 1Answers: 10,052 Site admin
    Answer ✓

    Hi Bob and Anders,

    I've just committed a fix for this issue to the Editor PHP libraries.

    If you'd like to try it immediately, you can patch your existing Editor.php with that change. If you do, let me know how you get on.

    Regards,
    Allan

  • LapointeLapointe Posts: 430Questions: 81Answers: 4

    Thanks @allan

    Do you have an estimated date for release publication ?

  • allanallan Posts: 61,438Questions: 1Answers: 10,052 Site admin
    Answer ✓

    Hoping we'll do a 2.0.2 next week, before the end of the month for sure.

    Allan

  • LapointeLapointe Posts: 430Questions: 81Answers: 4

    Very nice. So i'll wait for this
    Have a good week end
    B)
    Bob

This discussion has been closed.