GithubHelp home page GithubHelp logo

pomm-project / modelmanager Goto Github PK

View Code? Open in Web Editor NEW
66.0 66.0 27.0 419 KB

Model Manager for the Pomm database framework.

License: MIT License

PHP 100.00%
database entity modelmanager php pomm postgres postgresql transaction

modelmanager's People

Contributors

chanmix51 avatar hugues-antoine avatar lunika avatar npanau avatar ronanguilloux avatar sanpii avatar scrutinizer-auto-fixer avatar stood avatar webaaz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

modelmanager's Issues

Empty primary key

If a RowStructure defines an empty primary key, like

        $this
            ->setRelation('foo')
            ->setPrimaryKey([])
            ->addField('foo_id', 'int4')
            etc..

then WriteQueries::updateOne and WriteQueries::deleteOne build a query which will update or delete all rows!

This is not a bug, but it should not be possible to define an empty primary key in a model.

The above code is the result of using the CLI code generator on a relation which uses a UNIQUE key instead of a PRIMARY KEY. Maybe the CLI code generator could throw a warning in such a case?

Add a Model::getModel() proxy method

In order to easily fetch other model classes from model methods, it would be nice to have a getModel($class) proxy method just like the one in ModelLayer.

Custom FlexibleEntity classes

Since issue #5 I've looked into FlexibleEntity and found that some of the get-methods and one has-methods do not return identical results. You can reproduce this by adding the following 2 tests in Unit/Model/FlexibleEntity.php. These tests reflect the current state and not the expected one!

    public function testGetters()
    {
        $entity = new PikaEntity(['pika' => 'whatever']);
        $this
            ->string($entity->get('pika'))
            ->isEqualTo('whatever')     // shouldn't this be 'WHATEVER'?
            ->string($entity->pika)
            ->isEqualTo('WHATEVER')
            ->string($entity['pika'])
            ->isEqualTo('WHATEVER')
            ->string($entity->getPika())
            ->isEqualTo('WHATEVER')
            ->array($entity->fields())
            ->isIdenticalTo(['pika' => 'whatever'])
            ->array($entity->extract())
            ->isIdenticalTo(['pika' => 'whatever', 'pika_hash' => md5('whatever')]); // shouldn't this be 'WHATEVER'?
    }

    public function testHasMethods()
    {
        $entity = new PikaEntity(['pika' => 'whatever']);
        $this
            ->boolean($entity->has('pika'))
            ->isTrue()
            ->boolean($entity->hasPika())
            ->isTrue()
            ->boolean(isset($entity->pika))
            ->isFalse() // should also be true!
            ->boolean(isset($entity['pika']))
            ->isTrue()
            ;
    }

For the get-methods I am not quite clear how results are expected. Should get('pika') return 'whatever' or the result of getPika()? Should fields() return the original value or the modified? how about extract()?

In my opinion all getters should return the same result, but there also should be some kind of method like fields() which returns the original values. extract() should return the modified values and could have an optional argument to get original values.

FlexibleEntityInterface::fields() and FlexibleEntityInterface::extract() are somehow a bit redundant

I don't see much differences actually, maybe other than the fact that the extract() method will recursively parse fields and call extract() when the value is an entity. Shouldn't it be the role of whatever formatter attempt to use extract() to recursively do this job, and not to the entity itself ?

I see only one use case where you'd call it within the ModelManager is when you insert one entity, which seems an error since in update you are using fields() instead., is there a bug or is there something I didn't understood ?

Moreover, the extract() method signature states:

Return an array with a representation of the object values. It is mostly used prior to a serialization in REST API or other string responses.

which is actually NOT what's happening in your code.

Switching schema on the fly

I'm working on a multi-tenant application, where the connection pooler would connect to an admin db, to get the information about the tenant's db an schema, and then connect to the db an set proper search path, the problem is that all Models include the schema name.

Having an option when Models are generated to disable prefixing a relation with a schema name would solve this problem.

Bulk processing

What's the best way to process something in bulk when using iterator e.g.

$foos = $model->findAll();

foreach ($foos as $foo) {
	if (foo) {
		$existed++;
	} else {
		$model->deleteOne($foo);
		$removed++;
	}

	unset($foo);
}

unset doesn't seem to do anything. And the memory just keeps going up.

StatefulEntityTrait::status() method is confusing

It took me a while to realize, but reading this:

    public function status($status = null)
    {
        if ($status !== null) {
            $this->status = (int) $status;

            return $this;
        }

        return $this->status;
    }

I could see that when you set the status, you return the entity, but if you don't, you return the status, return type is varying and it's confusing.

How about a setStatus() and a getStatus() method instead ?

Object hydration problem when the binding is null

An error is raised if product insurer is empty, which obviously in view of the connection may be the case (left join). The error is No such field 'id'. Existing fields are {titre}

AutoStructure

class ProductAssureur extends RowStructure
{
    /**
     * __construct
     *
     * Structure definition.
     *
     * @access public
     */
    public function __construct()
    {
        $this
            ->setRelation('public.product_assureur')
            ->setPrimaryKey(['id'])
            ->addField('titre', 'varchar')
            ->addField('description', 'varchar')
            ->addField('is_active', 'bool')
            ->addField('id', 'int4')
            ->addField('created_at', 'timestamp')
            ->addField('updated_at', 'timestamp')
            ->addField('pdf_type', 'varchar')
            ->addField('path', 'varchar')
            ->addField('is_concurrent', 'bool')
            ;
    }
}

Query

$sql = <<<SQL
SELECT
    :projection
FROM
    :lead lead
    LEFT JOIN :lead_line lead_line_products ON lead_line_products.order_id = lead.id AND lead_line_products.type = 0
    LEFT JOIN lead_line lead_line_options ON lead_line_options.order_id = lead.id AND lead_line_options.type = 1
    LEFT JOIN :product_product ON lead_line_products.product_id = product_product.id
    LEFT JOIN product_product options ON options.id = lead_line_options.product_id
    LEFT JOIN :product_assureur ON product_product.assureur_id = product_assureur.id OR options.assureur_id = product_assureur.id
WHERE :condition
GROUP BY lead.id, product_assureur.*
ORDER BY $field $sorting
SQL;

$projection = $this->createProjection()->setField('product_assureur', 'product_assureur', '\Sel\Component\Model\****\PublicSchema\ProductAssureur');

Course results

foreach($results as $res) {
    var_dump($res);
}
exit;

When a $res is null (because does not have an product insurer)

CRITICAL - Uncaught PHP Exception InvalidArgumentException: "No such field 'id'. Existing fields are {titre}" at /var/www/***/***/www/vendor/pomm-project/model-manager/sources/lib/Model/FlexibleEntity/FlexibleContainer.php line 64 

Stack Trace

#1 in vendor/pomm-project/model-manager/sources/lib/Model/FlexibleEntity/FlexibleContainer.php at line 64

61.            if (isset($this->container[$name]) || array_key_exists($name, $this->container)) {
62.                $output[$name] = $this->container[$name];
63.            } else {
64.                throw new \InvalidArgumentException(
65.                    sprintf(
66.                        "No such field '%s'. Existing fields are {%s}",
67.                        $name,

#2 at FlexibleContainer ->fields (array('id')) 
in vendor/pomm-project/model-manager/sources/lib/Model/IdentityMapper.php at line 50 

50.        return sha1(sprintf("%s|%s", serialize($entity->fields($primary_key)), get_class($entity)));

#3 at IdentityMapper ::getSignature (object(ProductAssureur), array('id')) 
in vendor/pomm-project/model-manager/sources/lib/Model/IdentityMapper.php at line 65

63.    public function fetch(FlexibleEntityInterface $entity, array $primary_key)
64.    {
65.        $signature = self::getSignature($entity, $primary_key);


#4 at IdentityMapper ->fetch (object(ProductAssureur), array('id')) 
in vendor/pomm-project/model-manager/sources/lib/Converter/PgEntity.php at line 133 

130.    {
131.        return $this
132.            ->identity_mapper
133.            ->fetch($entity, $this->row_structure->getPrimaryKey())
134.            ;
135.    }

#5 at PgEntity ->cacheEntity (object(ProductAssureur)) 
in vendor/pomm-project/model-manager/sources/lib/Converter/PgEntity.php at line 90

#6 at PgEntity ->fromPg (null, '\Sel\Component\Model\Fidanimo\PublicSchema\ProductAssureur', object(Session)) 
in vendor/pomm-project/model-manager/sources/lib/Model/HydrationPlan.php at line 173

#7 at HydrationPlan ->convert ('fromPg', ... 'product_assureur' => null)) 
in vendor/pomm-project/model-manager/sources/lib/Model/HydrationPlan.php at line 122

120.    public function hydrate(array $values)
121.    {
122.        $values = $this->convert('fromPg', $values);
123.        return $this->createEntity($values);
124.    }

Possibly missing information in Quick Pomm2 setup

Hello,

I experiment pomm, and i'm practicing with the documentation (get started).

At the end of this documentation, i wrote that :
$bugs = $pomm['my_db']
->getModel('\Vendor\Project\MyDb\PublicSchema\MantisBugTableModel')
->findWithWhere1(new Where('reporter_id', 6));

It generates errors below :
Fatal error: Uncaught PommProject\ModelManager\Exception\ModelException: Could not instantiate Model class '\Vendor\Project\MyDb\PublicSchema\MantisBugTableModel'. (Reason: 'Class \Vendor\Project\MyDb\PublicSchema\MantisBugTableModel does not exist'). in D:__wamp64\www\pomm\get_started\vendor\pomm-project\model-manager\sources\lib\Model\ModelPooler.php on line 60

I've seen an other issue (#82).
However, i don't understand that needs of pomm, to run correctly.
I must change composer.json file, its'ok, but what do i change ?

vendor
.pomm_cli_boostrap.php
test1. php (contains the main program, where i use pomm)
composer.json
sources\lib\Model\MyDb\PublicSchema{allModelsOfMySchema}

composer.json :

"autoload": {
		"psr-4": {
			"Vendor\\Project\\": "sources/lib/Model"
		}
	},

beginning of a Model file in sources\lib\Model\MyDb\PublicSchema :

<?php 
namespace Vendor\Project\Model\MyDb\PublicSchema;

How do i change composer.json, test1.php, to run correctly pomm ?

Thanks in advance.

Null value casted in string

I have a special case where a <null> value in my database is cast as an empty string in my entity. But it's not always the case, it only happens when the entity is loaded from a complex query

screenshot-2017-10-31 symfony profiler 1

On the screenshot it is the subscription_history table. The result is this one :

screenshot-2017-10-31 symfony profiler

and in my database I have this value

screenshot from 2017-10-31 14-56-15

the origin field is null but I have an empty string here. When I load this subscription_history record in a simple query (directly fron the SubscriptionHistoryModel I have no error.

I don't know if it's a foudation or model manager issue

Project roadmap and participation in development

I don't see roadmap/todo file in repositories. As I understand currently you only make bugfixes and code is frozen until 2.0 stable.
Could you please create resource/codument with description of coming versions changes and how to participate in project development.

Thanks

PgEntity convert null value into empty string

In some cases, when using a composite field type and PgEntity converter, a nullable field will be converted to an empty string. This is the case when the nullable field is a string type like varchar, text, uuid, ...

The problem is that PgEntity uses str_getcsv to split the composite row value, essential like this

$data = '28c2cf5f-4df9-4e6f-a5d6-a41eaba35285,"test","",';    
$values = str_getcsv($data);

foreach ($values as $val) {
  var_dump($val) . PHP_EOL;
}

Unfortunately this will return an empty string, where it should not be.

string(36) "28c2cf5f-4df9-4e6f-a5d6-a41eaba35285"
string(4) "test"
string(0) ""
string(0) ""

Depending on the type declared in the RowStructure definition, an empty string may be interpreted as null value within the hydration plan (e.g. in case of boolean, numeric, int, ...), but it is not possible to determine the correct value for string types just from the empty string.

As PgComposite also uses str_getcsv I would assume the same behaviour for that converter. But I've not tested that.

Any idea how to avoid str_getcsv?

Model and interfaces

Hello,

Is it possible to create a set of interfaces which assure that a model class implements methods of ReadQueries or / and WriteQueries traits ?

It would be nice and more easier to integrate Pomm's models with those interfaces (via adapters for example).

Wrong FlexibleEntity status on modification

According to FlexibleEntityInterface there are 3 statuses, but on existing in DB entity modification we get not existing status $entity->status() == 3. This is caused by StatefulEntityTrait::touch method as $this->status = 1 and 1 | 2 == 3.

To replicate

$proposal = $this->pomm()->getModel(ProposalModel::class)               
            ->findByPk(['proposal_id' => $this->params('proposal_id')]);

echo $proposal->status(); // 1
$proposal->setDeadline('10/10/2016');
$proposal->status(); // 3 BUT should be 2

Cli command for migration

That should be useful if we can setup an SQL migration script on Model and reload the AutoStruct at end.

Can not extends model

I tried to extends a model, but can't done it without defining a new flexibleEntity.
Without this new flexibleEntity, I got an error : A converter named '\Database\OrganizationSchema\People' already exists

"nested transactions" in pomm?

As I understand the ModelLayer concept, this is the place to put multiple queries into one transaction.

Supposed I have a method in a ModelLayer class which uses a transaction and want to wrap that method call into another transaction. In ModelLayer I have to check if there is currently an active transaction and decide whether to use startTransaction() or setSavepoint(). This goes like this (every time)

$inTransaction = $this->isInTransaction();
try {
  if ($inTransaction)
    $this->setSavepoint('sp_1');
  else
    $this->startTransaction();

Same goes for commits and rollbacks which is pretty annoying. Is there already an elegant way to avoid this?

I usually solved this by implementing a simple transaction stack, who keeps track of ongoing transactions and save points. begin, commit or rollback methods take care of what method to use. I've copied a trivial example in here.

IdentityMapper and modified FlexibleEntities

Pomm uses the Identity Map pattern to avoid having multiple instances of the same FlexibleEntity instance (identified by the primary key). In other words, issuing the same query twice should return the same FlexibleEntity reference.

But how about modified FlexibleEntities? Suppose a simple user object, e.g.

$user = $UsersModel->findWhere('username = $*', 'pika')->current();
$user2 = $UsersModel->findWhere('username = $*', 'pika')->current();
// $user === $user2 is true

$user->setFirstname('Pika');
// $user === $user2 is still true 
// ($user->status() & FlexibleEntityInterface::STATUS_MODIFIED) ===  FlexibleEntityInterface::STATUS_MODIFIED

$user3 = $UsersModel->findWhere('username = $*', 'pika')->current();
// ($user->status() & FlexibleEntityInterface::STATUS_MODIFIED) ===  FlexibleEntityInterface::STATUS_MODIFIED

// but $user->getFirstname() !== 'Pika'

Is this behavior the correct one?
So either the entity status should be reset to "not modified" or the entity has to keep the modified values.

The latter could be achieved by simply swapping the arguments of array_merge in FlexibleContainer::hydrate():

    /**
     * hydrate
     *
     * @see FlexibleEntityInterface
     */
    public function hydrate(array $values)
    {
        // was $this->container = array_merge($this->container, $values);

        $this->container = array_merge($values, $this->container);
        return $this;
    }

Any opinions on this?

Projection, with and array_agg

Hi,
I have a "vehicule" table. Each vehicule has a collection of element. Each element has a detail in a separate table.

Vehicule

  • vehicule_id
  • label

VehiculeEquipement

  • vehicule_id
  • equipement_id
  • price

Equipement

  • equipement_id
  • euipement_label

To retrieve a vehicule, I have this function: https://gist.github.com/bolbo/0eea9640a5b29c5c8d38
If I remove equipement_label from the projection in the WITH, I have my vehicule.
But with equipement_label, I have a "Notice: Undefined offset: 11".

Can someone help me find the problem ?
Thanks

Wrong method invocation for magic methods in FlexibleEntity

Hi all,

I'm facing a weird issue with my tests of Pomm ModelManager, integrated to Symfony.

I defined my models (from an existing database structure), queried my database, and got my objects back.
But when I try to use the objects (originaly using Twig, but i get the same error by querying isset($object->property)) I'm facing this issue :

PommProject\ModelManager\Exception\ModelException No such key 'hastitle'.

Here is the stack trace :

at FlexibleEntity ->get ('hastitle') vendor/pomm-project/model-manager/sources/lib/Model/FlexibleEntity.php at line 172
at FlexibleEntity ->__call ('getHastitle', array()) in vendor/pomm-project/model-manager/sources/lib/Model/FlexibleEntity.php at line 307  
at Post ->getHastitle () in vendor/pomm-project/model-manager/sources/lib/Model/FlexibleEntity.php    
at line 307   
at FlexibleEntity ->__get ('hasTitle') in vendor/pomm-project/model-manager/sources/lib/Model/FlexibleEntity.php at line 323   
at FlexibleEntity ->__isset ('title') in src/AppBundle/Controller/Blog/PostController.php at line 41   

Taking a look to the __isset method of FlexibleEntity you can see the following :

    public function __isset($var)
    {
        $method_name = "has".Inflector::studlyCaps($var);

        return $this->$method_name;
    }

To me, the problem is that the call parenthesis are missing, the method should be :

    public function __isset($var)
    {
        $method_name = "has".Inflector::studlyCaps($var);

        return $this->$method_name();
    }

And the problem may be the same in the __unset method, so :

    public function __unset($var)
    {
        $method_name = "clear".Inflector::studlyCaps($var);

        return $this->$method_name();
    }

I tried to fork the project, and create some tests. Unfortunately, Im' not very familiar with Atoum, and I got some problem running the test suite itself, so...

More explicite miss configuration error message

Hello,

pomm-project/pomm-bundle#18

The error message like:

No pooler registered for type 'model'. Poolers available: {prepared_query, query_manager, converter, observer, inspector, listener}.
Do you use the correct session builder?

And write (my eyes have skipped all text after …):

$pomm = new Pomm([
    'project_name' => [
        'dsn' => …,
        'class:session_builder' => '\PommProject\ModelManager\SessionBuilder',
    ],
    …
]);

Is more readable.

Get model class from entity

I would like to get the model class from a flexible entity instance ...
Is there a simple way to do this ?

I need this for my custom UniqueFlexibleEntityValidator which validate that a database record doesn't exists for a field set (like a slug).
It is what the DoctrrineUniqueEntityValidator does (@see https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php).
I need to access to the model class from the flexible entity instance in the validation process (to test uniqueness).

I can add a custom constant (MODEL_CLASS) in my flexible entity class but it is not optimized ...

Thanks

Make the use of prepared statement configurable

The automatic use of prepared statements in the model manager’s query manager makes impossible to use it with tools like PgBouncer. It should be possible to configure the model manager to it does not use prepared statements.

Convenient methods in flexible entities

I've tried to implement a convenient method hasChildNodes in a FlexibleEntity sub class. This method determines its boolean return value from other attributes. There is no field child_nodes in the query or method getChildNodes() accordingly.

When I call extract() on this entity and getChildNodes() returns true, a ModelException is thrown:

No such key 'child_nodes'. in ..../vendor/pomm-project/model-manager/sources/lib/Model/FlexibleEntity.php on line 71

FlexibleEntity::getIterator() tries to resolve the custom attribute child_nodes via the get* method, which fails because there is no such attribute or method.

I've looked into the code and found that this is part of the overloading feature which is mentioned in the docs and in your comment, stating that it is possible to implement overload methods get* if the according has* method is also implemented.

But having a has* method without a get* method won't work. I am not sure if this is a bug or could somehow circumvented. I would really like being able to use both possibilities.

Custom function execution on insert/update for field

Hi there
I have geometry field, i.e. ->addField('location', 'public.geometry')
and I want to make converting from text to geometry type on insert/update (but question is in general. this concrete situation is only an example). So the only solution I found is something like this

    protected function getParametersList(array $values)                         
    {                                                                           
        $parameters = [];                                                                                      

        foreach ($values as $name => $value) {                                                                 
            if ($name == 'location') {                                                                         
                $parameters[$name] = sprintf(                                                                  
                    "ST_PointFromText('POINT(' || $* || ')', 4326)::%s",        
                    $this->getStructure()->getTypeFor($name)                    
                );                                                                                             
                continue;                                                                                      
            }                                                                                                  

            $parameters[$name] = sprintf(                                                                      
                "$*::%s",                                                                                      
                $this->getStructure()->getTypeFor($name)                        
            );                                                                                                 
        }                                                                                                      

        return $parameters;                                                                                    
    }  

But it has drawbacks as two values are passed as single one so I can't separately escape each of them. The same situation with creation of of custom converter + I can't pass function with single quote in it.
Maybe you know more elegant way to implement such on-fly converting of several values with functions

Thanks you

WriteQueries :: UpdateByWhere

Hello, i don't know if this idea has been already discussed,
but i think that could be helpful to have an method updateByWhere.

I've done this method for me

    public function updateByWhere(Where $where, Array $params) {

        $entities = $this->findWhere($where);

        foreach ($entities as $entity) {

            foreach ($params as $key => $value) {
                $entity->$key = $value;
            }

            $this->updateOne($entity, array_keys($params));
        }

        return $entities;
    }

Choose not to return the projection of the query

For security reasons I want to query a table with a Postgresql role that has only insert permission (the user is not the owner of the table).

As every Pomm WriteQueries returns the projection, I get the following error message:
ERROR: permission denied for relation table.

The role must also have "select" permission to return the projection.

Would it be possible to choose not to return the projection of queries (it could just return true or false instead) in order to use a role without select permission?

Thanks.

Does Pomm suffer of the problem of useless order by on some ORM prefetches ?

Hello,

Recently I found a problem with Django and submitted a patch in a PR:
https://code.djangoproject.com/ticket/35309
django/django#17984
I also developped a work-around for old versions of Django:
https://github.com/LLyaudet/django-monkey-patches/blob/main/src/django_monkey_patches/django__orm__prefetch_without_useless_order_by.py

I don't know yet Pomm details.
The idea is just that some models can have a default ordering (I assume this functionality is present in Pomm also).
And that some ORM may still add this ordering in the SQL query whilst it is not needed because only a single object will be prefetched per instance of the original result set.
On very big prefetches I noticed a gain of 10 - 15 %,
since the rest of the DB query is mainly an index scan.
#ClimateChangeBrake

Can someone please dump the queries of such prefetches and see if the bug is present in Pomm ?
If so submitting a PR should not be too hard.
I will try to help.
But right now, I start by warning the frameworks/ORM I am aware of :)

Best regards,
Laurent Lyaudet

Disable Prefixing with session name and/or schema

If only one schema and/or session is used in a project then there is no need to nest the Models so deep.

Having an option to disable prefix for either of them would be nice as this would also mean less deep namespaces

Best way to unit test a ModelLayer class

As already discussed in #8, only within a ModelLayer class it is possible to start and commit/rollback transactions, as for instance per definition Model methods should be atomic.

Now talking about PHPUnit, I would like to start in my setUp routine a transaction which will be rollbacked after a test completes to ensure data consistency among all tests.

What is the best way to achieve this? Or should I do something like:

/** @before */
public function setUp() {
  $db->getConnection()->executeAnonymousQuery('begin transaction')
}

/** @after */
public function tearDown() {
  $db->getConnection()->executeAnonymousQuery('rollback transaction')
}

I am using Silex by the way ...

Cheers

Error docs

Salut, dans le code suivant, l'accesseur $my_entity->get('field1'); vaut également 2 ? non ?

<?php
//…
class MyEntity extends FlexibleEntity
{
    public function getField1()
    {
        return $this->get('field1') * 2;
    }
}
//…
$my_entity = new MyEntity(['field1' => 1]);
$my_entity->field1;         // 2
$my_entity['field1'];       // 2
$my_entity->get('field1');  // 1
$my_entity->getField1();    // 2
`

Factor Model class generation code

Model, Structure and entity classes generation code should be in the ModelManager package to be used by CLI packages whatever they are the CLI or Zend, Sf, etc… packages.

Converter error when using composite type

When a composite type belongs to a schema, INSERT fails because the query is like the following:

INSERT INTO my_table (…) VALUES ($*::my_schema.my_type, …)

The converter system takes the first parameter to be a my_schema type.

Possibly missing information in Quick Pomm2 setup

I am trying to build a new site using http://www.pomm-project.org/documentation/sandbox2
There is a problem at one point (until this line everything is ok):
$computers = $pomm['cbkmis']->getModel('\CbkMis\PublicSchema\ComputerModel');
Generates an error (from error.log of apache):
PHP Fatal error: Uncaught PommProject\\ModelManager\\Exception\\ModelException: Could not instantiate Model class '\\CbkMis\\PublicSchema\\ComputerModel'. (Reason: 'Class \\CbkMis\\PublicSchema\\ComputerModel does not exist'). in /var/www/html/cbk-mis/vendor/pomm-project/model-manager/sources/lib/Model/ModelPooler.php:60

If I check included files (before I call getModel) with get_included_files(); I get only files within the vendor directory (nothing from the source directory)... it might be the problem. But how is it possible to fix it?

This issue asks developer to update the tutorial: Quick setup 2.0

Pomm version is: 2.0.*@dev
PHP version is: 7.0.22-0ubuntu0.16.04.1

registerFilter() and twig

After added a relation to a collection with registerFilter(), I have an error when I would display it in a twig template:

in FlexibleEntity.php line 66
at FlexibleEntity->get('hasperson') in FlexibleEntity.php line 172
at FlexibleEntity->__call('getHasperson', array()) in FlexibleEntity.php line 307
at Expense->getHasperson() in FlexibleEntity.php line 307
at FlexibleEntity->__get('hasPerson') in FlexibleEntity.php line 323
at FlexibleEntity->__isset('person') in Template.php line 445
at Twig_Template->getAttribute(object(Expense), 'person', array()) in Environment.php(332) : eval()'d code line 95
at __TwigTemplate_534e5c8457df35cd1a95d77a02b43fdd4dc961b9ca93e8d94599b8886d1158a0->block_content(array('payment' => object(Payment), 'expenses' => object(CollectionIterator), 'app' => object(Application)), array('content' => array(object(__TwigTemplate_534e5c8457df35cd1a95d77a02b43fdd4dc961b9ca93e8d94599b8886d1158a0), 'block_content'))) in Template.php line 154
at Twig_Template->displayBlock('content', array('payment' => object(Payment), 'expenses' => object(CollectionIterator), 'app' => object(Application)), array('content' => array(object(__TwigTemplate_534e5c8457df35cd1a95d77a02b43fdd4dc961b9ca93e8d94599b8886d1158a0), 'block_content'))) in Environment.php(332) : eval()'d code line 85
at __TwigTemplate_b3ea856be7aa361d0f7b526b094ac64b4030da4ef3c17c62d259f72192d71bfc->doDisplay(array('payment' => object(Payment), 'expenses' => object(CollectionIterator), 'app' => object(Application)), array('content' => array(object(__TwigTemplate_534e5c8457df35cd1a95d77a02b43fdd4dc961b9ca93e8d94599b8886d1158a0), 'block_content'))) in Template.php line 313
at Twig_Template->displayWithErrorHandling(array('payment' => object(Payment), 'expenses' => object(CollectionIterator), 'app' => object(Application)), array('content' => array(object(__TwigTemplate_534e5c8457df35cd1a95d77a02b43fdd4dc961b9ca93e8d94599b8886d1158a0), 'block_content'))) in Template.php line 287
at Twig_Template->display(array('payment' => object(Payment), 'expenses' => object(CollectionIterator), 'app' => object(Application)), array('content' => array(object(__TwigTemplate_534e5c8457df35cd1a95d77a02b43fdd4dc961b9ca93e8d94599b8886d1158a0), 'block_content'))) in Environment.php(332) : eval()'d code line 24
at __TwigTemplate_534e5c8457df35cd1a95d77a02b43fdd4dc961b9ca93e8d94599b8886d1158a0->doDisplay(array('payment' => object(Payment), 'expenses' => object(CollectionIterator), 'app' => object(Application)), array('content' => array(object(__TwigTemplate_534e5c8457df35cd1a95d77a02b43fdd4dc961b9ca93e8d94599b8886d1158a0), 'block_content'))) in Template.php line 313
at Twig_Template->displayWithErrorHandling(array('payment' => object(Payment), 'expenses' => object(CollectionIterator), 'app' => object(Application)), array('content' => array(object(__TwigTemplate_534e5c8457df35cd1a95d77a02b43fdd4dc961b9ca93e8d94599b8886d1158a0), 'block_content'))) in Template.php line 287
at Twig_Template->display(array('payment' => object(Payment), 'expenses' => object(CollectionIterator))) in Template.php line 298
at Twig_Template->render(array('payment' => object(Payment), 'expenses' => object(CollectionIterator))) in Environment.php line 293
at Twig_Environment->render('payment/edit.html.twig', array('payment' => object(Payment), 'expenses' => object(CollectionIterator))) in Payment.php line 101
at Payment->editPayment(object(Application), '-1')
at call_user_func_array(array(object(Payment), 'editPayment'), array(object(Application), '-1')) in HttpKernel.php line 145
at HttpKernel->handleRaw(object(Request), '2') in HttpKernel.php line 66
at HttpKernel->handle(object(Request), '2', true) in Application.php line 547
at Application->handle(object(Request), '2') in Payment.php line 57
at Payment->addPayment(object(Application))
at call_user_func_array(array(object(Payment), 'addPayment'), array(object(Application))) in HttpKernel.php line 145
at HttpKernel->handleRaw(object(Request), '1') in HttpKernel.php line 66
at HttpKernel->handle(object(Request), '1', true) in Application.php line 547
at Application->handle(object(Request)) in Application.php line 524
at Application->run() in index.php line 12

I maybe made something wrong, but I have no error with pomm1.

https://github.com/sanpii/coloc/blob/pomm2/src/Controller/Expenses.php#L49

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.