Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Nov 19 12:50

    jcheron on master

    surround getBlockNames with try… (compare)

  • Nov 19 11:34
    jcheron labeled #158
  • Nov 19 11:34
    jcheron assigned #158
  • Nov 19 11:34
    jcheron opened #158
  • Nov 19 11:18
    jcheron review_requested #157
  • Nov 18 23:50
    jcheron commented #157
  • Nov 18 23:50

    jcheron on master

    fixed password_hash $algo type … (compare)

  • Nov 18 23:50
    jcheron closed #157
  • Nov 18 23:32
    churow opened #157
  • Nov 17 00:49

    jcheron on master

    fix DB logger omitted + $cache … (compare)

  • Nov 12 18:59
    jcheron labeled #156
  • Nov 12 18:59
    jcheron assigned #156
  • Nov 12 18:59
    jcheron labeled #156
  • Nov 12 18:59
    jcheron opened #156
  • Nov 12 01:38

    jcheron on 2.3.11

    (compare)

  • Nov 12 01:30

    jcheron on master

    [skip ci] richClient doc suite (compare)

  • Nov 12 00:39

    jcheron on master

    fix Htmldropdown arrow pb (compare)

  • Nov 09 23:50

    jcheron on master

    Async Startup light opt (#155) … (compare)

  • Nov 09 23:50
    jcheron closed #155
  • Nov 09 23:49
    jcheron opened #155
jcheron
@jcheron
Hi @JamesMahy
There was indeed a problem on the lines you mentioned.
It should be better with this fix: phpMv/ubiquity@7c6e58a
James Mahy
@JamesMahy
Awesome, thanks @jcheron
Damir Zelenika
@dysback
Hi
I installed Ubiquity by:
composer global require phpmv/ubiquity-devtools
but it is not globally available
on my Ubuntu-1804-bionic-64-minimal
I found it at $HOME/.config/composer/vendor/phpmv/ubiquity-devtools/src/Ubiquity
Damir Zelenika
@dysback
is it possible to set Ubiquity command globally available during installation?
jcheron
@jcheron
Hi @dysback
by placing export PATH="$HOME/.config/composer/vendor/bin:$PATH" into your ~/.bashrc file.
James Mahy
@JamesMahy

Hey @jcheron it's your favourite annoying dev again :) Was wondering if there's a method to retrieve a twig view into a string instead of rendering it with $this->loadView

I would like to use Twig to parse my mail templates so that I don't have to build a seperate template parser

jcheron
@jcheron

Hi @JamesMahy ,
You should use the third parameter of the loadview method:

$str=$this->loadView('viewName',['datas'=>$datas],true);

see https://api.kobject.net/ubiquity/class_ubiquity_1_1controllers_1_1_controller.html#a80a71e60aa536de9b98b7b773fb54bec

anjelagrant
@anjelagrant_twitter
hi
how does the community compare with rails?
jcheron
@jcheron
Hi @anjelagrant_twitter
I don't quite understand the meaning of your question.
James Mahy
@JamesMahy

hey @jcheron hope you're well?

Is there a way to specify two columns as a primary key in your model system?

jcheron
@jcheron
Hi @JamesMahy
I'm fine, how are you?
Yes, just add the @id annotation on the members to be integrated to the primary key
    /**
     * @id
     * @column("name"=>"id1","nullable"=>false,"dbType"=>"int(11)")
     * @validator("id","constraints"=>array("autoinc"=>false))
     */
    private $id1;

    /**
     * @id
     * @column("name"=>"id2","nullable"=>false,"dbType"=>"int(11)")
     * @validator("id","constraints"=>array("autoinc"=>false))
     */
    private $id2;
James Mahy
@JamesMahy
Good!, I'm alright :) and thank you!!
James Mahy
@JamesMahy
@jcheron is there a way with your DAO to do a left join? eg
SELECT * FROM roles LEFT JOIN roles_permissions ON id = role_id WHERE roles.enabled = 1;
or even better
SELECT 
    roles.id, 
    roles.name, 
    roles.description, 
    permissions.id as permission
FROM roles 
    LEFT JOIN roles_permissions ON id = role_id  
    LEFT JOIN permissions on permissions.id = permission_id
    WHERE 
        roles.enabled = 1 
        AND 
        permissions.enabled = 1;
jcheron
@jcheron

Hi @JamesMahy
No sorry, this is not possible.
There is no queryBuilder like with Doctrine, it's a design choice, DAO is only object-oriented.

Besides, if it were possible, how would you make the difference in an object-oriented approach between permissions assigned to the role and those that are not?

On the other hand, it may be interesting to add a method that does the equivalent, i.e. load all the permissions, marking those assigned to the role in your case.
a method getLeftMany($role, 'permissions') returning something like [[perm1,true], [perm2,false]...]
jcheron
@jcheron
In the meantime, you can easily get the equivalent data in an object logic :
//The role permissions:
$permsRole=$role->getPermissions();
//All permissions:
$allPerms=DAO::getAll(Permission::class, 'enabled=?',false,[true]);

//The permissions not assigned to the role :
$permNot=\array_diff_keys($allPerms,$permsRole);
With an Asynchronous server (Swoole for example), we can assume that all permissions are already loaded and globally accessible, and this object solution will have better performance than the SQL solution with left join.
Andrei Dascalu
@andrei-dascalu
Hello everyone, I wonder if anyone happens to have any examples on defining middlewares with the uibiquity framework router?
Andrei Dascalu
@andrei-dascalu
I also have an error when doing a basic setup using devtools CLI, Class 'Ubiquity\utils\base\UIntrospection' not found in vendor/phpmv/ubiquity-commands/src/Ubiquity/devtools/cmd/Command.php:562
I'm not entirely sure I follow how devtools can be used to setup Ubiquity project if base\UIntrospection is required by the CLI (which can be installed globally) but at the same time it can only be found in the framework itself (which is supposed to be pulled by the CLI when setting up a project)
jcheron
@jcheron
see phpMv/ubiquity-devtools#21 for Ubiquity\utils\base\UIntrospection pb
jcheron
@jcheron

Hello everyone, I wonder if anyone happens to have any examples on defining middlewares with the uibiquity framework router?

Hi @andrei-dascalu
The Ubiquity router does not implement the Middleware concept (see in the future).
You can nevertheless get around this lack by using dependency injection or the initialize or finalize methods of the controllers...

churow
@churow
Hi, what is the best practice for putting model specific properties? If I put them in the model itself, "Ubiquity model" command, after some alteration to the DB table, overwrites them. The app/config/config.php is suggested to be slim. If I make my own model which extends the generated model, "Ubiquity init-cache", and use it instead of the generated model, I got errors because its cache does not have annotation related information like #fieldNames.
jcheron
@jcheron
Hi @churow
It all depends on what you mean by specific properties.
Should these properties persist in the database?
churow
@churow
Thanks @jcheron. I don't think it should persist in DB. It is like a config value for a model. It is a minimum sequencial value for every user's special code like prefix + sequencial numbers + suffix. At present I put it as a property of ControllerBase class, but it would be better if the property is only visible to user related controllers. What would you do in this situation?
jcheron
@jcheron
If they are configuration variables, that can be modified, you can add them in app/config/config.php.
But if they concern only a part of the application, and you want to avoid loading them unnecessarily when they are not used, you can create a specific configuration file in app/config/, and load this file in the concerned part ( base controller for the users).
class UsersBaseController extends BaseController {
    private $config;
    public function __construct() {
        parent::__construct();
        $this->config = include \ROOT . 'config/users.php';
    }
}
If, on the contrary, these values are not subject to change, a constant in the relevant controller will do the trick:
class UsersBaseController extends BaseController {
    private const CONFIG = [
        'prefix' => 'u_'
    ];

    public function index() {
        print_r( self::CONFIG);
    }
}
churow
@churow
Thank you very much with the detailed examples, @jcheron!
jcheron
@jcheron
You're welcome :)
teachtocode
@teachtocode
Hi , I am very happy with your framework , my doubt is how can i disable Admin panel ui(web tools) , i needed the web tools ui in my local development but how can i disable when i am going to deploy it.
jcheron
@jcheron
getit0
@getit0
Hello there! I found ubiquity pretty awesome! Trying to get msaccess odbc connection to have easy relationships for my models. Is it possible? How to fill dropdowns with table data, maby some ready grid or example iteration? How to easy deploy public in production server? Trying to find an easy frontend framework, that automaticaly find, say date fields and create fast ui. Please an example for many to many auto select drop down fields, that shows text related field from pivots. Nice to meet you!
jcheron
@jcheron

Hi @getit0 and thank you for this feedback!
That's a lot of questions...

MsAccess

this is unfortunately not possible.
You can easily perform DAO operations (via PDO), but not generate the classes (you would need a specific wrapper for MSAccess, which has not been implemented).

jcheron
@jcheron

UI

For the UI and Front-End part, Ubiquity uses by default phpMv-UI (PHP components library based on Semantic-UI and jQuery)
So to generate a Semantic UI dropdown from a model, you can do :

public function clientsDropDownTest(){    
    $clients=DAO::getAll(\models\Client::class);
    $form=$this->jquery->semantic()->htmlForm('frm');
    $form->addDropdown('clients',JArray::modelArray($clients,'getId','__toString'));
    $this->loadView('ddTest.html');
}

In the associated view, you can display the form:

{{ q['frm'] | raw }}
CRUD scaffolding can give you an idea of the possibilities.
jcheron
@jcheron

Deployment

For the deployment, everything depends on the available server solution. I advise you to read the Servers and Optimization parts of the guide.
And to come back to me if you have other questions
jcheron
@jcheron

ManyToMany and Dropdown

The easiest first step is to create a CRUD controller for the model, and see if you can get the desired result by customizing it.
getit0
@getit0
Thank you for your speedly answers!!! I have a lot to test!
churow
@churow
Can I DAO::save() same instance twice (the first one will insert and the second one should update)? The Ubiquity\orm\parser\Reflexion's static variable $classProperties stores the first time (insert) properties, which lack primary key, so the second DAO::save(), which needs primary key to update, fails with "SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens" error.
jcheron
@jcheron
I've just tried (2 consecutive calls of the save method for the same object) and I didn't notice this problem.
jcheron
@jcheron
@churow Have you solved your problem?
churow
@churow
Hi, @jcheron. I just bypassed the problem by rewriting the code to DAO::save() only once..
jcheron
@jcheron
And can you show me your code (the old one), that I can check to see if there is a bug, thank you @churow .