Objects are in Jarves structured data, like a SQL table. Jarves uses per default Propel as ORM, which hides all SQL magic.
You can build upon objects very easily crud views using yml. (Example Jarves/Group CRUD)
Abstraction for REST interface is:
1. REST API 2. ObjectCrud controller (builds the REST API and crud views/routes) 3. ObjectStorage (Jarves\Storage\Propel or Jarves\Storage\AbstractStorage) 4. Propel (per default) 5. SQL Database
Abstraction for internal object interface is:
1. Jarves\Objects interface (`@jarves.objects`) 2. ObjectStorage (Jarves\Storage\Propel or Jarves\Storage\AbstractStorage) 3. Propel (per default) 4. SQL Database
You can query, add, update or remove objects via several interfaces.
- REST API
- Jarves\Objects interface
- Propel classes directly
- SQL Database (you shouldn't do that)
Each abstraction does its very worthy thing, please do not choose the lowest, because it's the fastest, because you could easily corrupt the application state.
If you for example change table rows of a nested object in a SQL database directly, you need to make sure
that the nested set model is still intact, which means
lvl are correctly set.
In Jarves the whole administration accesses the application and all its controllers and objects using a RESTful API. That means you could easily access all information too using the HTTP protocol. See [REST-API(documentation/rest-api) for more information.
This controller is used to build all REST routes for every object. You can of course subclass this controller
for your object using the
crudService property at object configuration.
If you use Propel as storage for your objects, you usually don't have to change here much. However, if you have objects that aren't stored with Propel, you need to write your object storage class itself. Examples are given in /Users/marc/bude/jarves.io/app/jarves/website/jarves.io/documentation/objects.yml.
You can change the storage service of a object using the
storageService property at object configuration.
If you want to access objects for your website/fronte end, you should use this interface as it handles also permission management (all applied ACLs) and returns objects as array. If you don't need ACL support, you can directly access objects using Propel.
$objects = $container->get('jarves.objects'); $objects->getList('jarves/node', ['type' => 0]); //returns all pages $objects->getList('jarves/node', ['domainId' => 1]); //returns all nodes of domain 1 $objects->getList('jarves/node', ['domainId' => 1], ['fields' => 'title']); //returns all pages, only the title, of domain 1
This interfaces provides much more methods you can use to manipulate and query normalized objects data.
For more information about this interface, take a look at the well documanted class: github.com/jarves/jarves/blob/master/Objects.php.
If you want to change objects fast, use Propel classes. They have a excellent documentation:
propelorm.org/documentation/03-basic-crud.html. All models
are stored in Jarves\Model. Example
$node = new Jarves\Model\Node(); or
$allNodes = Jarves\Model\NodeQuery::create()->find();
Please note: When you change objects directly using Propel, make sure all caches are correctly resetted, so Jarves does not work with outdated stuff.
Found a typo? The website is based on Markdown, please feel free to send us a pull request! :) github.com/jarves/jarves.io/tree/master/app/jarves/website/jarves.io