Questions tagged [lithium]

Lithium is an RAD framework for PHP 5.3+

Lithium, an RAD framework for PHP, is focused on quality, speed, and flexibility. It's a set of philosophies and tools that enable one to build applications quickly, without sacrificing quality, extensibility, or control of the framework.

Lithium understands distributed storage and caching, queuing systems, micro-dispatch frameworks, with integrated support for document oriented databases like CouchDB and MongoDB, alongside relational databases like MySQL and SQLite.

Official Lithium (li3) Homepage

The Manual

API

The Source Code on GitHub

301 questions
2
votes
1 answer

Mongodate convert

After executing the query $orders = Orders::connection()->connection->command(array( 'aggregate' => 'orders', 'pipeline' => array( array( '$group' => array( '_id' => array('cust_id'=>'$cust_id','ord_date'=>'$ord_date'), …
Nilam Doctor
  • 491
  • 7
  • 18
2
votes
2 answers

Setting safe => 'majority' for MongoDB using Li3

I am using PHP Lithium Framework. Is there a way to set safe => 'majority' through configuration. I am using mongodb replication and want to make sure that the data is written to majority of replicaset members before the driver returns success. I am…
kobra
  • 4,853
  • 10
  • 32
  • 33
2
votes
1 answer

PHP kill script after disconnection of client

Currently I am working on a system in PHP (for syncing data between webservices) (using the Lithium framework) which makes multiple requests to different webservices through curl. For every response in a request (could be quite some few, lets say…
Matthijn
  • 3,126
  • 9
  • 46
  • 69
2
votes
1 answer

Prevent form manipulation in Lithium/mongoDB

I'm writing my first community page with Lithium and mongoDB. I really like the schema-less way of mongo, but there is one problem making it impossible working without a schema: For instance we have a simple form like…
HenningCash
  • 2,030
  • 18
  • 17
2
votes
0 answers

How do I create a complete list of valid routes (api endpoints)?

What I have done is use Library::locate to find controllers, calling Router::match on them based on a whitelist property. I also have a shared controller that many models use and I use locate on models with a whitelist there. This is sort of…
Alexander Morland
  • 6,356
  • 7
  • 32
  • 51
2
votes
1 answer

MongoDB queries in Lithium - should I use `order` or `$orderby`, or doesn't it matter?

The following two criteria sets give me identical results using Lithium and MongoDB. Both are equally easy to read and write. Should I prefer one over the other for efficiency reasons, or is one just Lithium/MongoDB syntactic sugar for the…
cfogelberg
  • 1,468
  • 19
  • 26
2
votes
1 answer

Lithium form helper not displaying the value zero (0) in a field

When using the Lithium framework for developing a PHP application, I am noticing that the value zero is not being displayed in a text field in a form. Currently, I am grabbing data from a MySQL database, displaying it, and updating it. I am able to…
iralls
  • 376
  • 4
  • 16
2
votes
1 answer

MongoCursorException being thrown, but not caught by try/catch in Lithium

I'm using \lithium\data\source\MongoDB::update() to do an upsert in safe mode. On some updates, there is an expected MongoCursorException due to a duplicate key being passed. The try/catch below does not catch the error, and it bubbles back up to an…
Eric C
  • 971
  • 6
  • 14
2
votes
3 answers

PHP Framework for TDD

I am starting work on a personal project which should (hopefully) develop into a startup, the project will need to scale well and I would prefer to invest the time now in TDD. I am a big Lithium fan, and I am aware that Lithium have their own built…
GaryDevenay
  • 2,405
  • 2
  • 19
  • 41
1
vote
0 answers

save new 1:n relationship

I have a record header with a model of RecordHeader RecordHeader (id PRIMARY KEY, entryDate DATETIME, fullName TEXT) I have record details with a model of RecordDetails RecordDetails (id PRIMARY KEY, headerID FOREIGN KEY, answer TEXT) My…
ton.yeung
  • 4,793
  • 6
  • 41
  • 72
1
vote
1 answer

PHP Lithium: Sorting an Embedded Object Array

I would love to sort an embedded MongoDB object using PHP Lithium. I have got a Model "Thread" which looks almost like this: { "_id": ObjectId("4f71bf4618b602580f000009"), "postings": [ {text: "a", upvotes: 15, /*...*/}, {text:…
YMMD
  • 3,730
  • 2
  • 32
  • 43
1
vote
1 answer

Lithium - Find tree based on relationships

I have created a RESTful PHP web service using Lithium which contains comments, each comment can have a parent comment allowing comments to be infinitely recursive. I have set up the relationship within my model using the correct key. My data is…
GaryDevenay
  • 2,405
  • 2
  • 19
  • 41
1
vote
1 answer

Lithium - How to get the number of fetched rows?

In Lithium, after fetching all rows of a given Model like this: $users = Users::all(); how can I know how many rows were returned? I'm using the MySQL connector. Thank you!
Tiago Alves
  • 1,301
  • 2
  • 18
  • 30
1
vote
1 answer

Removing history entries for files and not being able to checkout folder

I downloaded the lithium library from it's git repo a while back, and was using that to build on my own application. I hadn't thought about the possible git issues as I didn't know much about git at the time (still don't really) - but I've now put…
Dan
  • 445
  • 6
  • 31
1
vote
1 answer

Lithium PHP Framework - Seeding Database?

What is the best way to seed a MongoDB database using Lithium PHP Framework, like in Ruby on Rails: rake db:seed Thanks!
João Rocha da Silva
  • 4,259
  • 4
  • 26
  • 35