andrew-kandels / contain Goto Github PK
View Code? Open in Web Editor NEWFast and lightweight entity model framework for PHP without the fuss of an ORM.
Home Page: http://www.contain-php.org
Fast and lightweight entity model framework for PHP without the fuss of an ORM.
Home Page: http://www.contain-php.org
While compiled entities provide the best performance and a larger degree of enforceability it does have drawbacks such as the inability to dynamically alter a document such that a "plugin" might do to add it's own data into the flow.
Take for instance a content management system or anything of the like. You might have a plugin that wants to store information on each post. It would be expensive to fetch that data from a separate collection rather than to store it in the same collection.
Therefore there are really a few different options here:
In case 2 above you might use __call() and provide the logic for implementing the getter/setter based off of the definition. Otherwise the other route here is to simply fetch the properties and have to fetch them from the extended properties area.
Allow sub-entity properties to be white-listed using a dot notation:
$model->export(array('field1', 'field2', 'subentity.field1')))
I have entity definitions on different levels of components... For instance: MyModule\MyService\Entity\Definition
I would expect that it would output: true / false. Found this while unit testing against arrays as assertEquals.
Example:
Allow sub-entity properties to also be set using dot notation (in addition to the nested arrays):
$a->fromArray(array('p1' => '1', 'subentity.p1' => '1'))
The generated formatting is; well.. ugly :) Might want to run php-cs-fixer on it or clean it up
There's a subtle variable name bug in AbstractEntity's isValid method. First $values
is set with all of the entity property values after they've been filtered, then when looping over any validation messages, $values
is used as the value variable in the foreach statement, overwriting the original array of filtered values.
/Users/mwillbanks/Projects/contain/tests/Contain/Entity/Property/Type/StringTypeTest.php:20
I have not changed anything around this area; so I'm guessing that you may have made the change on purpose OR it's a ๐
If model A has properties p1 and p2 and you call:
$a->fromArray(array('p1' => '1', 'p2' => '2', 'p3' => 3))
It should set properties p1/p2 as expected; but also set an extended property for "p3" to 3.
There shouldn't be any downside to this as extended properties are never exported -- just a little extra space.
Dude; need your help to write the driver part of this. I have the connection part (aka the easy part) done. Just working through the adapter and it is very mongolishious so I'm not quite sure where to put in some of the logistical items.
When will Contain support DynamoDBโฝโฝ
Entity\Property\Type\ListEntity can not be defined on more than one model's properties at a time. I believe it may be an issue with the pivoter sharing data or not resetting properly.
I'm not sure if it is intentional or not but since it is populated on the entity it would seem to me that the entity should run the validators against the entries.
Say for instance a validator on a number field; you give it a string value it will still populate and not complain.
$param = new Param();
$messages = array();
if ($request->isPost()) {
$form->setData($request->getPost());
echo 'hiiiiii';
if (!$form->isValid())
{
$errors = $param->getInputfilter();
foreach($errors as $key=>$row)
{
if (!empty($row) && $key != 'submit') {
foreach($row as $rower)
{
//save error(s) per-element that
//needed by Javascript
$messages[$key][] = $rower;
}
}
}
}
// $messages=$form->setInputFilter($param->getInputFilter());
var_dump($messages);
if (!empty($messages)){
$response->setContent(\Zend\Json\Json::encode($messages));
} else
{
$response->setContent(\Zend\Json\Json::encode(array('success'=>1)));
return $response;
}
There is a limited amount of work that you need to do in order to provide a way to support modules rather than having to support a whole application. Although since it is different I decided it might be best to open an issue about it.
When running Compile Namespace the result of the generated entity and assets show the namespace as the full path to that namespace.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.