by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Sep 19 00:36

    jcheron on master

    [ci skip] update benchmark scre… (compare)

  • Sep 19 00:29

    jcheron on master

    [ci skip] update benchmark links (compare)

  • Sep 18 23:40

    jcheron on master

    [ci skip] update benchmarks urls (compare)

  • Sep 16 10:15

    jcheron on master

    [skip ci] Update CHANGELOG (compare)

  • Sep 14 13:56

    jcheron on master

    Fix runCallable with di pb (compare)

  • Sep 14 13:40

    jcheron on master

    [ci-tests] remove error 500 (compare)

  • Sep 14 13:18

    jcheron on master

    [ci-tests] test callable route … (compare)

  • Sep 14 11:33
    jcheron commented #21
  • Sep 14 11:28
    andrei-dascalu commented #21
  • Sep 14 10:48
    jcheron commented #21
  • Sep 14 10:46
    jcheron commented #21
  • Sep 14 10:38
    jcheron assigned #21
  • Sep 14 10:38
    jcheron labeled #21
  • Sep 14 08:34
    andrei-dascalu edited #21
  • Sep 14 08:33
    andrei-dascalu opened #21
  • Sep 14 00:27

    jcheron on master

    Update UbiquityExceptionTest.php (compare)

  • Sep 14 00:09

    jcheron on master

    [ci-tests] remove file inclusion (compare)

  • Sep 13 23:27

    jcheron on master

    [ci-tests] exceptions tests (compare)

  • Sep 13 22:59

    jcheron on master

    Update LoggerTest.php (compare)

  • Sep 13 22:31

    jcheron on master

    Update LoggerTest.php (compare)

James Mahy
@JamesMahy
also if the .ubiquity folder doesn't exist you can't run init-cache
seems a bit weird that it's a requirement
NoTeefy
@NoTeefy
@jcheron Hey. I am really sorry for the delayed response, I have a lot of projects going on atm. It worked after using the transaction and committing it manually after the update routine. It seems like they changed the default flag for autocommit on the latest MariaDB version which is why it didn't happen before.
Thanks a lot for your precious work and the fast support.
I am pretty sure I had that PDO flag in my options and it didn't work with them, but I could retest that behaviour if you want
I really hope to be able to contribute to this awesome project at some point :)
@JamesMahy Not really if you think about what's containted in that directory. It holds all configs like the autoloader, your router, and the default startup routine
the autoloader is required for the init-cache command afaik
jcheron
@jcheron

seems a bit weird that it's a requirement

@JamesMahy
The .ubiquity folder is what allows the Ubiquity client to correctly identify the location and structure of the project. It is what allows you to launch an Ubiquity command whatever folder you are in, inside the project.
And as @NoTeefy rightly points out, it is also used by servers (php, Swoole, RoadRunner...) to store their configuration and index page.

jcheron
@jcheron
@NoTeefy
It might be good to try again, yes.
It will be embarrassing if this behavior is encountered again.
James Mahy
@JamesMahy

.ubiquity is just an empty folder it doesn't contain anything but it's used like a sort of lock file so init-cache doesn't recognise you're inside a ubiquity project unless it's there.

The issue here is that when you store the project in github, to deploy you need recreate the folder or put a .gitkeep file inside of it.

Wouldn't a .ubiquity file make sense instead of a folder?

also it seems weird that the system would just barf a stack trace because the views folder doesn't exist, I had to dig through the code to understand what the issue was. Not all projects will require the views folder and if you insist it's a requirement, shouldn't it just throw an error out to the error log, not the client?
jcheron
@jcheron
@JamesMahy
The folder is empty because you are not using any asynchronous servers.
It may be possible that an .ubiquity file is an equivalent.
jcheron
@jcheron
If the framework emits an error for the absence of the views folder, you have started the template engine.
I guess if you don't have this folder, you are not using the views.
So you should remove these 2 lines from the configuration file :
        "templateEngine"=>'Ubiquity\\views\\engine\\Twig',
        "templateEngineOptions"=>array("cache"=>false),
And you won't be needing any more views folder.
James Mahy
@JamesMahy
ok ty
jcheron
@jcheron
And you probably don't need the injection of the graphics library either,
so you can also remove:
        "di"=>["@exec"=>["jquery"=>function($controller){
                        return \Ubiquity\core\Framework::diSemantic($controller);
                    }]],
And you don't use that either:
        "isRest"=>function(){
            return \Ubiquity\utils\http\urequest::getUrlParts()[0]==="rest";
        },
James Mahy
@JamesMahy

hey @jcheron

Remember our key name issue? I'm still getting it but only when I try to create multiple objects in a loop

class SomeModel
{
    /**
     * @id
     */
    private int $id = 0;

    /**
     * @column("name"=>"unique_id")
     */
    private string $uniqueId = '';
}
for($x=1;$x<=250;$x++){
            $model = new SomeModel();
            $model->setUniqueId(substr(bin2hex(random_bytes(40)), 0, 40));

            if(DAO::save($model)){
                echo $model->id;
            }
        }

The first iteration always succeeds, every subsequent one I get

[Wed Jun 10 17:06:51.719239 2020] [php7:error] [pid 84] [client 172.17.0.1:42490] PHP Fatal error:  Uncaught PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'uniqueId' in 'field list' in /var/www/html/vendor/phpmv/
ubiquity/src/Ubiquity/orm/traits/DAOUpdatesTrait.php:145\nStack trace:\n#0 /var/www/html/vendor/phpmv/ubiquity/src/Ubiquity/orm/traits/DAOUpdatesTrait.php(145): PDOStatement->execute()\n#1 /var/www/html/vendor/phpmv/ubiquity/src/Ubiqui
ty/orm/traits/DAOUpdatesTrait.php(315): Ubiquity\\orm\\DAO::insert()\n#2 /var/www/html/app/controllers/Index.php(139): Ubiquity\\orm\\DAO::save()\n#3 /var/www/html/vendor/phpmv/ubiquity/src/Ubiquity/controllers/Startup.php(148): contro
llers\\Index->generateBots()\n#4 /var/www/html/vendor/phpmv/ubiquity/src/Ubiquity/controllers/Startup.php(100): Ubiquity\\controllers\\Startup::runAction()\n#5 /var/www/html/vendor/phpmv/ubiquity/src/Ubiquity/controllers/Startup.php(69
): Ubiquity\\controllers\\Startup::forward()\n#6 /var/www/html/index.php(7): Ubiquity\\controllers\\Startup::run()\n#7 {main}\n  thrown in /var/www/html/vendor/phpmv/ubiquity/src/Ubiquity/orm/traits/DAOUpdatesTrait.php on line 145
James Mahy
@JamesMahy
This message was deleted
So in phpmv\ubiquity\src\Ubiquity\orm\parser\Reflexion.php line 53 - line 58
self::$classProperties Isn't populated on the first instance but is incorrectly populated on the 2nd instance - I'm guessing this is meant to be some sort of caching mechanism?
James Mahy
@JamesMahy
if (isset ( self::$classProperties [$className] )) {
            foreach ( self::$classProperties [$className] as $prop ) {
                $ret [$prop->getName ()] = $prop->getValue ( $instance );
            }
            return $ret;
        }
If I comment out this chunk of code, everything works as expected

Line 68

self::$classProperties [$className] [] = $prop;

If i change to

self::$classProperties [$name] [] = $prop;

it works. Don't know if this is correct so will leave it down to your expertease :)

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...